Skip to content

Commit

Permalink
fix: update Postman translation for request URL
Browse files Browse the repository at this point in the history
  • Loading branch information
sanish-bruno committed Feb 12, 2025
1 parent ba25983 commit b28cc81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const replacements = {
'pm\\.response\\.headers': 'res.headers',
'pm\\.response\\.size': 'res.getSize()',
"tests\\['([^']+)'\\]\\s*=\\s*([^;]+);": 'test("$1", function() { expect(Boolean($2)).to.be.true; });',
'pm\\.request\\.url': 'bru.getUrl()',
'pm\\.request\\.url': 'req.getUrl()',
'pm\\.request\\.method': 'req.getMethod()',
'pm\\.request\\.headers': 'req.getHeaders()',
'pm\\.request\\.body': 'req.getBody()',
Expand Down
11 changes: 5 additions & 6 deletions packages/bruno-js/src/bruno-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BrunoRequest {
* - req.headers
* - req.timeout
* - req.body
*
*
* Above shorthands are useful for accessing the request properties directly in the scripts
* It must be noted that the user cannot set these properties directly.
* They should use the respective setter methods to set these properties.
Expand All @@ -21,9 +21,9 @@ class BrunoRequest {
/**
* We automatically parse the JSON body if the content type is JSON
* This is to make it easier for the user to access the body directly
*
*
* It must be noted that the request data is always a string and is what gets sent over the network
* If the user wants to access the raw data, they can use getBody({raw: true}) method
* If the user wants to access the raw data, they can use getBody({raw: true}) method
*/
const isJson = this.hasJSONContentType(this.req.headers);
if (isJson) {
Expand Down Expand Up @@ -91,7 +91,7 @@ class BrunoRequest {

/**
* Get the body of the request
*
*
* We automatically parse and return the JSON body if the content type is JSON
* If the user wants the raw body, they can pass the raw option as true
*/
Expand All @@ -115,7 +115,7 @@ class BrunoRequest {
* Otherwise
* - We set the request data as the data itself
* - We set the body property as the data itself
*
*
* If the user wants to override this behavior, they can pass the raw option as true
*/
setBody(data, options = {}) {
Expand Down Expand Up @@ -168,7 +168,6 @@ class BrunoRequest {
__isObject(obj) {
return obj !== null && typeof obj === 'object';
}


disableParsingResponseJson() {
this.req.__brunoDisableParsingResponseJson = true;
Expand Down

0 comments on commit b28cc81

Please sign in to comment.