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,
|
||||
apiTokenSchema.$id,
|
||||
serializeDates(token),
|
||||
{ location: `api-tokens` },
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,9 @@ class TagTypeController extends Controller {
|
||||
req.body,
|
||||
userName,
|
||||
);
|
||||
res.status(201).json(tagType);
|
||||
res.status(201)
|
||||
.header('location', `tag-types/${tagType.name}`)
|
||||
.json(tagType);
|
||||
}
|
||||
|
||||
async updateTagType(
|
||||
|
@ -69,6 +69,7 @@ export class OpenApiService {
|
||||
res: Response<T>,
|
||||
schema: SchemaId,
|
||||
data: T,
|
||||
headers: { [header: string]: string } = {},
|
||||
): void {
|
||||
const errors = validateSchema(schema, data);
|
||||
|
||||
@ -76,6 +77,10 @@ export class OpenApiService {
|
||||
this.logger.debug('Invalid response:', errors);
|
||||
}
|
||||
|
||||
Object.entries(headers).forEach(([header, value]) =>
|
||||
res.header(header, value),
|
||||
);
|
||||
|
||||
res.status(status).json(data);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user