We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4cd8013 commit 4711344Copy full SHA for 4711344
test/test.ts
@@ -205,5 +205,29 @@ describe('CORS middleware', () => {
205
});
206
207
208
+ it('should pass through OPTIONS requests if no Origin header was set', async () => {
209
+
210
+ const options = {
211
+ allowOrigin: ['https://example.org'],
212
+ allowHeaders: ['Content-Type', 'Accept'],
213
+ allowMethods: ['GET', 'POST'],
214
+ exposeHeaders: ['Link', 'Date']
215
+ };
216
+ const headers = {};
217
+ const app = new Application;
218
+ app.use(cors(options));
219
220
+ app.use( ctx => {
221
222
+ ctx.status = 200;
223
+ ctx.response.body = ctx.method;
224
225
+ });
226
227
+ const response = await app.subRequest('OPTIONS', '/', headers);
228
+ expect(response.status).to.equal(200);
229
+ expect(response.body).to.equal('OPTIONS');
230
231
232
233
0 commit comments