Skip to content

Commit

Permalink
Merge pull request #478 from HubSpot/hotfix/add-method-and-endpoint-t…
Browse files Browse the repository at this point in the history
…o-local-serverless

Added endpoint and method to function context to match production context
  • Loading branch information
miketalley authored Apr 28, 2021
2 parents 65aa226 + 5a0a68a commit d73b4f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/serverless-dev-runtime/lib/data.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs-extra');
const { logger } = require('@hubspot/cli-lib/logger');
const { getDotEnvData } = require('./secrets');
const { MOCK_DATA, MAX_SECRETS } = require('./constants');
const { MOCK_DATA, MAX_SECRETS, ROUTE_PATH_PREFIX } = require('./constants');

const getValidatedFunctionData = path => {
// Allow passing serverless folder path with and without .functions extension
Expand Down Expand Up @@ -118,6 +118,8 @@ const getFunctionDataContext = async (
},
body: req.body,
headers: getHeaders(req),
method: req.method,
endpoint: req.url.replace(`/${ROUTE_PATH_PREFIX}`, ''),
accountId: accountId || HUBSPOT_ACCOUNT_ID || MOCK_DATA.HUBSPOT_ACCOUNT_ID,
contact:
contact === 'true' || contact === true
Expand Down

0 comments on commit d73b4f9

Please sign in to comment.