mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-21 13:47:39 +02:00
#1391: fix remaining 201 location headers missing
This commit is contained in:
parent
fe07191c63
commit
d29400d59a
@ -165,6 +165,7 @@ export class ApiTokenController extends Controller {
|
|||||||
res,
|
res,
|
||||||
apiTokenSchema.$id,
|
apiTokenSchema.$id,
|
||||||
serializeDates(token),
|
serializeDates(token),
|
||||||
|
{ location: `api-tokens` },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,9 @@ class TagTypeController extends Controller {
|
|||||||
req.body,
|
req.body,
|
||||||
userName,
|
userName,
|
||||||
);
|
);
|
||||||
res.status(201).json(tagType);
|
res.status(201)
|
||||||
|
.header('location', `tag-types/${tagType.name}`)
|
||||||
|
.json(tagType);
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateTagType(
|
async updateTagType(
|
||||||
|
@ -69,6 +69,7 @@ export class OpenApiService {
|
|||||||
res: Response<T>,
|
res: Response<T>,
|
||||||
schema: SchemaId,
|
schema: SchemaId,
|
||||||
data: T,
|
data: T,
|
||||||
|
headers: { [header: string]: string } = {},
|
||||||
): void {
|
): void {
|
||||||
const errors = validateSchema(schema, data);
|
const errors = validateSchema(schema, data);
|
||||||
|
|
||||||
@ -76,6 +77,10 @@ export class OpenApiService {
|
|||||||
this.logger.debug('Invalid response:', errors);
|
this.logger.debug('Invalid response:', errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object.entries(headers).forEach(([header, value]) =>
|
||||||
|
res.header(header, value),
|
||||||
|
);
|
||||||
|
|
||||||
res.status(status).json(data);
|
res.status(status).json(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user