[GH-ISSUE #1036] pw.response.body is an ArrayBuffer instead of object #365

Closed
opened 2026-03-16 14:55:20 +03:00 by kerem · 3 comments
Owner

Originally created by @KoalaMoala on GitHub (Jul 31, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1036

Originally assigned to: @AndrewBastin on GitHub.

Describe the bug

I was expecting to have an object like described here https://github.com/liyasthomas/postwoman/wiki/Post-Requests-Tests#accessing-response-data but got ArrayBuffer instead

To Reproduce
Steps to reproduce the behavior:

  1. Import following collection
[
  {
    "name": "My Collection",
    "folders": [], 
    "requests": [
      {   
        "url": "https://httpbin.org",
        "path": "/get",
        "method": "GET",
        "auth": "None",
        "httpUser": "", 
        "httpPassword": "", 
        "passwordFieldType": "password",
        "bearerToken": "", 
        "headers": [], 
        "params": [
          {   
            "key": "key",
            "value": ""
          }   
        ],  
        "bodyParams": [], 
        "rawParams": "", 
        "rawInput": true,
        "contentType": "", 
        "requestType": "", 
        "preRequestScript": "pw.env.set('toto', 'yolo');",
        "testScript": "pw.expect(pw.response.status).toBe(200);\npw.expect(pw.response.body).toHaveProperty('args');",
        "label": "", 
        "name": "My first request :)",
        "collection": 0
      }   
    ]   
  }
]
  1. Run My first request :)
  2. The second test fails with Expected object [object ArrayBuffer] to have property args

Desktop (please complete the following information):

  • MacOs Catalina, v10.15.5
  • Browser Firefox v78.0.2 && Chrome v84.0.4147.89

Thank you for your work on this project, it's very impressive !

Originally created by @KoalaMoala on GitHub (Jul 31, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1036 Originally assigned to: @AndrewBastin on GitHub. **Describe the bug** I was expecting to have an object like described here https://github.com/liyasthomas/postwoman/wiki/Post-Requests-Tests#accessing-response-data but got ArrayBuffer instead **To Reproduce** Steps to reproduce the behavior: 1. Import following collection ```json [ { "name": "My Collection", "folders": [], "requests": [ { "url": "https://httpbin.org", "path": "/get", "method": "GET", "auth": "None", "httpUser": "", "httpPassword": "", "passwordFieldType": "password", "bearerToken": "", "headers": [], "params": [ { "key": "key", "value": "" } ], "bodyParams": [], "rawParams": "", "rawInput": true, "contentType": "", "requestType": "", "preRequestScript": "pw.env.set('toto', 'yolo');", "testScript": "pw.expect(pw.response.status).toBe(200);\npw.expect(pw.response.body).toHaveProperty('args');", "label": "", "name": "My first request :)", "collection": 0 } ] } ] ``` 2. Run `My first request :)` 3. The second test fails with `Expected object [object ArrayBuffer] to have property args` **Desktop (please complete the following information):** - MacOs Catalina, v10.15.5 - Browser Firefox v78.0.2 && Chrome v84.0.4147.89 Thank you for your work on this project, it's very impressive !
kerem 2026-03-16 14:55:20 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@liyasthomas commented on GitHub (Jul 31, 2020):

Thanks for reporting the issue. Looking into it.

<!-- gh-comment-id:667194936 --> @liyasthomas commented on GitHub (Jul 31, 2020): Thanks for reporting the issue. Looking into it.
Author
Owner

@AndrewBastin commented on GitHub (Jul 31, 2020):

This is due to the recent move to the Binary Responses System. I think we will have to introduce some helper methods to convert the body to JSON object ?

<!-- gh-comment-id:667218418 --> @AndrewBastin commented on GitHub (Jul 31, 2020): This is due to the recent move to the Binary Responses System. I think we will have to introduce some helper methods to convert the body to JSON object ?
Author
Owner

@liyasthomas commented on GitHub (Jul 31, 2020):

Yes. Array buffer is served for tests. A helper function to convert response body should work.

<!-- gh-comment-id:667219114 --> @liyasthomas commented on GitHub (Jul 31, 2020): Yes. Array buffer is served for tests. A helper function to convert response body should work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#365
No description provided.