Compare methods across redirects

Compare historical method rewriting with explicit method-preserving redirect semantics.

  • redirects
  • methods

Prediction

The redirect status, not the Location field alone, determines whether automatic following can rewrite POST to GET or must preserve method and content.

Controlled observation

The future comparison will show the original request, redirect response, and fixed-target request for 301, 303, 307, and 308 without accepting a destination.

Explanation

Historical behavior permits rewriting after 301 and 302; 303 explicitly selects a retrieval, while 307 and 308 preserve method and content.

Controlled exercise

Run this observation

Inspect the final controlled echo to see the method and body bytes received after following.

Ready. No request has run.

Controlled request

Method
POST
URL
https://lab.httpclarity.com/v1/redirect-method/301
Permitted headers
Content-Type: text/plain
Body
5 bytes (fixed): fixed

Browser-observed response

No response yet. The explanation and examples remain useful without JavaScript or the Worker.

Timing is browser elapsed time. Fetch hides Set-Cookie, raw wire bytes, reliable compressed size, and some redirect details.

Portable examples

cURL

              'curl' '--include' '--request' 'POST' '--header' 'Content-Type: text/plain' '--data' 'fixed' 'https://lab.httpclarity.com/v1/redirect-method/301'
            

Fetch API

              const response = await fetch("https://lab.httpclarity.com/v1/redirect-method/301", {
  "method": "POST",
  "headers": {
    "Content-Type": "text/plain"
  },
  "body": "fixed"
});
console.log(response.status, await response.text());
            

PHP

              <?php
$options = ['http' => [
    'method' => 'POST',
    'ignore_errors' => true,
    'header' => 'Content-Type: text/plain',
    'content' => 'fixed',
]];
$context = stream_context_create($options);
$body = file_get_contents('https://lab.httpclarity.com/v1/redirect-method/301', false, $context);
var_dump($http_response_header, $body);
            

Need a full API client? Copy the generated cURL command, then import it in Hoppscotch. HTTPClarity sends no request data to Hoppscotch.

Continue in Hoppscotch (opens in a new tab)

Primary sources