Skip to content

Commit

Permalink
Merge pull request #948 from francisu/issue-947
Browse files Browse the repository at this point in the history
ISSUE-947 cors options are ignored for the lambda server
  • Loading branch information
dherault committed Apr 2, 2020
2 parents 36414e3 + 33dec85 commit 8e405d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -82,6 +82,7 @@
"Egor Kislitsyn (https://github.com/minibikini)",
"Elliott Spira (https://github.com/em0ney)",
"Ethan Moistner (https://github.com/emmoistner)",
"Francis Upton IV (https://github.com/francisu)",
"Francisco Guimarães (https://github.com/franciscocpg)",
"G Roques (https://github.com/gbroques)",
"Gabriel Verdi (https://github.com/ansraliant)",
Expand Down
4 changes: 2 additions & 2 deletions src/lambda/HttpServer.js
Expand Up @@ -23,8 +23,8 @@ export default class HttpServer {

async start() {
// add routes
const _invocationsRoute = invocationsRoute(this.#lambda)
const _invokeAsyncRoute = invokeAsyncRoute(this.#lambda)
const _invocationsRoute = invocationsRoute(this.#lambda, this.#options)
const _invokeAsyncRoute = invokeAsyncRoute(this.#lambda, this.#options)

this.#server.route([_invokeAsyncRoute, _invocationsRoute])

Expand Down
3 changes: 2 additions & 1 deletion src/lambda/routes/invocations/invocationsRoute.js
Expand Up @@ -5,7 +5,7 @@ import InvocationsController from './InvocationsController.js'
const { parse } = JSON

// https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
export default function invocationsRoute(lambda) {
export default function invocationsRoute(lambda, options) {
const invocationsController = new InvocationsController(lambda)

return {
Expand Down Expand Up @@ -48,6 +48,7 @@ export default function invocationsRoute(lambda) {
// request.payload will be a raw buffer
parse: false,
},
cors: options.corsConfig,
tags: ['api'],
},
path: '/2015-03-31/functions/{functionName}/invocations',
Expand Down
3 changes: 2 additions & 1 deletion src/lambda/routes/invoke-async/invokeAsyncRoute.js
Expand Up @@ -3,7 +3,7 @@ import InvokeAsyncController from './InvokeAsyncController.js'
const { parse } = JSON

// https://docs.aws.amazon.com/lambda/latest/dg/API_InvokeAsync.html
export default function invokeRoute(lambda) {
export default function invokeRoute(lambda, options) {
const invokeAsyncController = new InvokeAsyncController(lambda)

return {
Expand All @@ -25,6 +25,7 @@ export default function invokeRoute(lambda) {
// request.payload will be a raw buffer
parse: false,
},
cors: options.corsConfig,
tags: ['api'],
},
path: '/2014-11-13/functions/{functionName}/invoke-async/',
Expand Down

0 comments on commit 8e405d3

Please sign in to comment.