Skip to content

Commit

Permalink
Update serverless-offline test dep
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed May 10, 2020
1 parent 344cb1d commit 22ee0e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"coveralls": "3.x.x",
"node-stream-zip": "1.x.x",
"serverless": "1.x.x",
"serverless-offline": "4.x.x",
"serverless-offline": "5.x.x",
"strip-ansi": "5.x.x",
"toys": "2.x.x"
}
Expand Down
16 changes: 11 additions & 5 deletions test/helpers.js
Expand Up @@ -95,11 +95,14 @@ exports.OfflineMock = class OfflineMock extends Offline {
this.options.skipCacheInvalidation = true;

this.serverlessLog = (...logs) => this.serverless.cli.log(...logs);
this.printBlankLine = () => this.serverlessLog();
}

async _listen() {
_buildServer() {

this.server.ext('onPreHandler', (request, reply) => {
const server = super._buildServer();

server.ext('onPreHandler', (request, h) => {

// Account for serverless-offline issue where multiValueHeaders are not set when using inject()

Expand All @@ -109,12 +112,15 @@ exports.OfflineMock = class OfflineMock extends Offline {
[header]: [].concat(value)
}), {});

return reply.continue();
return h.continue;
});

await this.server.initialize();
this.apiGateway.printBlankLine = () => this.printBlankLine();
this.apiGateway._listen = async () => await server.initialize();

this.server = server;

return this.server;
return server;
}

async end() {
Expand Down

0 comments on commit 22ee0e4

Please sign in to comment.