Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

53
Vistas
Chrome Extension get POST Request Data

I am trying to get the formData of a POST request with a chrome extension. I am using the following manifest.json file and background.js file. However, when I console.log the requestBody I cannot see the formData which was sent by the website. How can I get the form elements?

manifest.json

{
  "manifest_version": 2,
  "name": "Form Data",
  "description": "Looks at some form data.",
  "version": "0.9",
  "background": {
    "scripts": ["background.js"]
  },
  "permissions": [
    "webRequest",
    "webRequestBlocking",
    "<all_urls>"
  ]
}
background.js

chrome.webRequest.onBeforeRequest.addListener(
    function(details) {
        if(details.method == "POST")
            console.log(JSON.stringify(details));
    },
    {urls: ["<all_urls>"]},
    ["requestBody"]
);

Example Response:

{"frameId":0,"initiator":"https://example.com","method":"POST","parentFrameId":-1,"requestBody":{"raw":[{"bytes":{}}]},"requestId":"13910","tabId":430,"timeStamp":1645826234368.5469,"type":"xmlhttprequest","url":"https://www.example.com/api/v4/login"}
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos