hoppscotch / hoppscotch-extension

🧩 Browser extensions to provide more capabilities to https://hoppscotch.io
https://hoppscotch.io
MIT License
254 stars 95 forks source link

Expose responseURL on returned response object #42

Closed rizdaprasetya closed 3 years ago

rizdaprasetya commented 3 years ago

Address https://github.com/hoppscotch/hoppscotch-extension/issues/41

What does this PR changes?

This expose Axios' response.request.responseURL value of response object, as a response.responseURL:

For more details and context, please check the linked issue above.

Tested? ✅

Works fine:

Sample result:

Screen Shot 2021-03-31 at 17 35 11
{
    "status": 200,
    "statusText": "",
    "headers": {  },
    "responseURL": "https://developers.googleblog.com/2018/03/transitioning-google-url-shortener.html",
    "data": "...",
    "timeData": {  }
}

In the sample above I try to proxy request through this extension, the request originally made to https://goo.gl which got redirected to another url. The final url is properly exposed as shown on the screenshot.

Note

The var name responseURL is opinionated, I just derive it from the original Axios' var name, let me know if you prefer other name.

Thanks!

AndrewBastin commented 3 years ago

Looks good to me!