How to read the contents of HTTP POST and GET requess in Chrome extension.

2,025 views
Skip to first unread message

John

unread,
Dec 1, 2016, 7:19:50 PM12/1/16
to Chromium-Extensions-Announce
Hi,

Here is the problem. How do I access the data sent via HTTP POST  or GET in chrome extension. I tried using the webRequest.onBeforeRequest.addListner and look for details.url.  But details.url is not showing the parameter values or form values that are sent. Basically I want to interrogate any malicious characters that are sent via POST and GET requests and block the website.  So my basic question is how to see the contents of POST and GET requests in chrome extension? Any help is greatly appreciated.


Here, the details.url is not showing the contents posted via HTTP post and GET requests.

chrome.webRequest.onBeforeRequest.addListener(function (details) 

       if(details.method == "GET")
                  coonsole.log(details.url);

}, 
{urls: ["<all_urls>"]}, ["blocking","requestBody"]);


Thanks
John Fedor

Antony Sargent

unread,
Dec 5, 2016, 3:10:08 PM12/5/16
to John, Chromium-Extensions-Announce
For POST requests, you want to look at the 'formData' or 'raw' properties on the object passed to chrome.webRequest.onBeforeRequest. 

For GET requests (and requests in general), did you already declare host permissions in the permissions section of manifest.json for the urls you're interested in?


If that doesn't solve the problem, you might look into using the webNavigation API. 




--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/f541973d-a8a9-4e26-b9e7-7f835a9dcb00%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Reply all
Reply to author
Forward
0 new messages