Skip to content

Commit

Permalink
Encode request body to handle special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
uditdc committed Sep 20, 2023
1 parent 94fed7c commit 3b329ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/function/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const run = async (options: any) => {
envVarsKeys.push('BLS_REQUEST_HEADERS')

if (request.body) {
envVars.push(`BLS_REQUEST_BODY="${JSON.stringify(request.body)}"`)
envVars.push(`BLS_REQUEST_BODY="${encodeURIComponent(JSON.stringify(request.body))}"`)
envVarsKeys.push('BLS_REQUEST_BODY')
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/sites/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const run = async (options: any) => {
envVarsKeys.push('BLS_REQUEST_HEADERS')

if (request.body) {
envVars.push(`BLS_REQUEST_BODY="${JSON.stringify(request.body)}"`)
envVars.push(`BLS_REQUEST_BODY="${encodeURIComponent(JSON.stringify(request.body))}"`)
envVarsKeys.push('BLS_REQUEST_BODY')
}

Expand Down

0 comments on commit 3b329ec

Please sign in to comment.