Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Changed environment variable to thundra_lambda_http_responseCheck_skip
Browse files Browse the repository at this point in the history
  • Loading branch information
İbrahim Gürses committed Jul 12, 2018
1 parent 87a748c commit df71f62
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -58,6 +58,7 @@ Check out the [configuration part](https://thundra.readme.io/docs/nodejs-configu
| thundra_lambda_trace_request_skip | bool | false |
| thundra_lambda_trace_response_skip | bool | false |
| thundra_lambda_timeout_margin | number | 200 |
| thundra_lambda_http_responseCheck_skip | bool | false |
| thundra_lambda_publish_rest_baseUrl | string | https<nolink>://collector.thundra.io/api |

#### 2. Module initialization parameters
Expand Down
1 change: 0 additions & 1 deletion src/constants.js
Expand Up @@ -25,7 +25,6 @@ export class TimeoutError extends Error {
}
}


export class HttpError extends Error {
constructor(message) {
super();
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -58,7 +58,7 @@ module.exports = (config) => {
requestCount: 0,
apiKey: apiKey,
timeoutMargin,
skipParseResponse :process.env.thundra_lambda_skip_parse_response === 'true' ? true : false,
skipHttpResponseCheck :process.env.thundra_lambda_http_responseCheck_skip === 'true' ? true : false,
};

plugins.forEach(plugin => {
Expand Down
2 changes: 1 addition & 1 deletion src/thundra-wrapper.js
Expand Up @@ -109,7 +109,7 @@ class ThundraWrapper {
response: result
};

if (this.pluginContext.skipParseResponse || this.isErrorResponse(result)) {
if (this.pluginContext.skipHttpResponseCheck || this.isErrorResponse(result)) {
afterInvocationData = {
error: new HttpError("Lambda returned with error response."),
response: result
Expand Down
4 changes: 2 additions & 2 deletions test/thundra-wrapper.test.js
Expand Up @@ -148,9 +148,9 @@ describe('ThundraWrapper', () => {
const thundraWrapper = new ThundraWrapper(originalThis, originalEvent, originalContext, originalCallback, originalFunction, plugins, pluginContext, apiKey);
thundraWrapper.executeHook = jest.fn();
thundraWrapper.isErrorResponse = jest.fn();
pluginContext.skipParseResponse = true;
pluginContext.skipHttpResponseCheck = true;
thundraWrapper.wrappedCallback(null, {statusCode: 500, body:'{\"message\":\"I have failed\"}'});
pluginContext.skipParseResponse = false;
pluginContext.skipHttpResponseCheck = false;
it('should isErrorResponse disabled', () => {
expect(thundraWrapper.isErrorResponse).not.toHaveBeenCalled();
});
Expand Down

0 comments on commit df71f62

Please sign in to comment.