HTTP Analyzer

Send an HTTP request and analyse the response

METHOD

Choose a method for sending HTTP requests: GET, POST, PUT, DELETE, HEAD

ENDPOINT

The endpoint website for receiving HTTP requests, for example: https://api.example.com/version

HEADERS

HTTP request header object, for example:

{
  "Content-Type": "application/json"
}

TEXT / FILE / FORM

Choose the content format of the request. If the content of the request is text or JSON data format, select TEXT, and enter the content in TEXT AS BODY. If the content of the request involves uploading a file, select FILE, and click the 📎 icon in FILE AS BODY to choose a file. For both request content formats, you must specify the Content-Type in HEADERS.

If you choose the FORM content format, you should provide the FormData in JSON data format. In this case, you do not need to specify Content-Type in HEADERS. When including files in FormData, you must specify the file name from your workspace, and it should have an extension. For example, if you want to include the file "avatar.jpg" from your working directory with the field name "avatar," it should be as follows:

{
  "username": "emily",
  "avatar": "avatar.jpg"
}

Input Object

The input object is the HTTP response content:

// Input Object
{
  url,         // The complete URL requested
  status,      // Response status code
  contentType, // MIME type of response content
  headers,     // Response headers
  body,        // String or Uint8Array  
}

Output Object

Each key added to the output object will be output as a .txt file in the workspace. The file name will be the key, and the text content will be the corresponding value.

// Output the response content to the workspace

if (input.contentType === 'application/json') {
  let jsonBody = JSON.parse(input.body)
  _.forEach(jsonBody, (value, key) => {
    output[key] = value
  })
}

if (input.contentType === 'image/png') {
  api.write('result.png', input.body)
}

--

We are dedicated to improving our content. Please let us know if you come across any errors, including spelling, grammar, or other mistakes, as your feedback is valuable to us! 🤖️⚡️

Last updated