question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Missing functionality] no option to send GET request with Body

See original GitHub issue

I’m trying to send a get request with a body using playwright. I did not find any resource / way how to do it. I would like to query the elasticsearch using get request with payload. example:

test("Get simki", async ({request})=> {
    const response = await request.get('http://test.test.be/es/ad_matrix_agg_*/_search', {
        headers:{
            'Authorization': 'Basic token',
            'Content-Type': 'application/json'
        },
      data:{
}
    }); 
    console.log(await response.json());
    expect(response.status()).toBe(200);
})

issue: There is no option to add data in get request like in post request.

trying to use data in get request did not work and got this:

get request issue

data error

it seems that there is a missing functionality ( that IMO is basic in order to query ElasticSearch for instance) can it be resolved and be added soon?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
moshikdcommented, Sep 21, 2022

@yury-s @pavelfeldman i have tested it with latest version playwright 1.26. It seems to work with fetch with GET method: fetch(‘http://test.test.com’, { method: ‘GET’… ( which is great) BUT it does not work with request.get ( as it mentioned in my first comment) . should it work also with request.get ?? thanks in advance

0reactions
YusukeIwakicommented, Oct 12, 2022

@moshikd It seems Playwright 1.27 includes the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP GET with request body - Stack Overflow
Yes, you can send a request body with GET but it should not have any meaning. If you give it meaning by parsing...
Read more >
GET method doesn't support body payload #2136 - GitHub
For HTTP GET method Swagger UI doesn't send body payload. I prepared endpoint (products/test) with simple request data (name field). On 'Try it ......
Read more >
OPTIONS - HTTP - MDN Web Docs
The HTTP OPTIONS method requests permitted communication options for a given URL or server. A client can specify a URL with this method, ......
Read more >
Add a Request Body to a POST Request | API Connector
If your POST request isn't working, a likely cause is a mismatched content type. Try adding in a content type into the header...
Read more >
Set up a method request in API Gateway - AWS Documentation
It allows you to use a single API method setup for all of the supported HTTP methods of DELETE , GET , HEAD...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found