Answer the question
In order to leave comments, you need to log in
How to get payload request data?
I work with one service, which recently started generating a unique session identifier. To work around the problem, I decided to use npm puppeteer . The bottom line is this - a site opens in Chromium, manual authorization occurs, then I select the data parameters on the site itself. After that, in Devtools, you can observe the request body I need
. Since the identifier is generated after entering the site, I did not find a way to get it, except for the above puppeteer
. After receiving the ID, I intend to use it in fetch () and use it to get the necessary Response of the request what i already got
Answer the question
In order to leave comments, you need to log in
The issue was resolved with the following lines of code
await page.on('response', async response => {
if(response.request().method() === 'POST' && response.request().url() ===
'https://website.com/'){
console.log(await response.request()._postData)
}
})
uh... what's the question?
intercept cookies and go:
there are no "sessions"
there are either cookies or POST (rarely) / GET headers (more often, but not as often as cookies) requests
(i.e. logically yes - there are sessions, but this data is intercepted because it is present in the headers or (more rarely) the body of the document)
it’s another matter that tools other than the [headless] browser can really not catch cookies set by JS frameworks,
respectively: either the headless browser intercepts cookies and then normal parsing, or all the time a parser based on such a browser
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question