Skip to content

Commit c4b3cca

Browse files
committed
ElementEndpoint.set|merge|update() return undefined instead of void when there is no response body
1 parent a7fc05f commit c4b3cca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

endpoints/generic/ElementEndpoint.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
6868
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
6969
* @throws {@link HttpError}: Other non-success status code
7070
*/
71-
async set(entity: TEntity): Promise<(TEntity | void)> {
71+
async set(entity: TEntity): Promise<(TEntity | undefined)> {
7272
const response = await this.putContent(entity);
7373
const text = await response.text();
7474
if (text) {
@@ -94,7 +94,7 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
9494
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
9595
* @throws {@link HttpError}: Other non-success status code
9696
*/
97-
async merge(entity: TEntity): Promise<(TEntity | void)> {
97+
async merge(entity: TEntity): Promise<(TEntity | undefined)> {
9898
this.responseCache = undefined;
9999
const response = await this.send(HttpMethod.Patch, {
100100
[HttpHeader.ContentType]: this.serializer.supportedMediaTypes[0]
@@ -118,7 +118,7 @@ export class ElementEndpoint<TEntity> extends ETagEndpointBase {
118118
* @throws {@link NotFoundError}: {@link HttpStatusCode.NotFound} or {@link HttpStatusCode.Gone}
119119
* @throws {@link HttpError}: Other non-success status code
120120
*/
121-
async update(updateAction: (entity: TEntity) => void, maxRetries: number = 3): Promise<(TEntity | void)> {
121+
async update(updateAction: (entity: TEntity) => void, maxRetries: number = 3): Promise<(TEntity | undefined)> {
122122
let retryCounter = 0;
123123
while (true) {
124124
const entity = await this.read();

0 commit comments

Comments
 (0)