mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Expose Location header via CORS.
Fixes https://github.com/solid/community-server/issues/441
This commit is contained in:
parent
af8524e0d6
commit
a5c372c37c
@ -17,6 +17,7 @@
|
||||
"DELETE"
|
||||
],
|
||||
"CorsHandler:_options_exposedHeaders": [
|
||||
"Location",
|
||||
"Updates-Via"
|
||||
]
|
||||
},
|
||||
|
@ -11,7 +11,7 @@ const port = 6002;
|
||||
|
||||
class SimpleHttpHandler extends HttpHandler {
|
||||
public async handle(input: { request: HttpRequest; response: HttpResponse }): Promise<void> {
|
||||
input.response.writeHead(200);
|
||||
input.response.writeHead(200, { location: '/' });
|
||||
input.response.end('Hello World');
|
||||
}
|
||||
}
|
||||
@ -65,6 +65,12 @@ describe('An Express server with middleware', (): void => {
|
||||
expect(res.header).toEqual(expect.objectContaining({ 'access-control-allow-origin': 'test.com' }));
|
||||
});
|
||||
|
||||
it('exposes the Location header via CORS.', async(): Promise<void> => {
|
||||
const res = await request(server).get('/').expect(200);
|
||||
const exposed = res.header['access-control-expose-headers'];
|
||||
expect(exposed.split(/\s*,\s*/u)).toContain('Location');
|
||||
});
|
||||
|
||||
it('sends incoming requests to the handler.', async(): Promise<void> => {
|
||||
const response = request(server).get('/').set('Host', 'test.com');
|
||||
expect(response).toBeDefined();
|
||||
|
Loading…
x
Reference in New Issue
Block a user