Skip to content

Commit

Permalink
fix: don't JSON.stringify body if its already a string
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed Jan 20, 2021
1 parent 4c79cbc commit 6d44059
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/v3/pact.ts
Expand Up @@ -136,7 +136,11 @@ export class PactV3 {
}

public withRequest(req: V3Request): PactV3 {
this.pact.addRequest(req, req.body && JSON.stringify(req.body))
let body = req.body
if (typeof body !== 'string') {
body = body && JSON.stringify(body)
}
this.pact.addRequest(req, body)
return this
}

Expand Down

0 comments on commit 6d44059

Please sign in to comment.