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

Send the fixed POST through a selected 301, 302, 303, 307, or 308 response. The final controlled echo reports the method and content bytes that arrived after automatic following.

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.

Interactive controls require JavaScript. The static response and portable examples remain available below.

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 live response yet. The representative static example remains useful without JavaScript or the Worker.

Static response example

HTTP/1.1 301
Location: /v1/redirect-target/method
X-Lab-Scenario: redirect-method

{"location":"/v1/redirect-target/method","scenario":"redirect-method"}

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

Portable examples

cURL
'curl' '--include' '--location' '--header' 'Content-Type: text/plain' '--data' 'fixed' 'https://lab.httpclarity.com/v1/redirect-method/301'
Scroll horizontally to read any long lines.
Fetch API
const response = await fetch("https://lab.httpclarity.com/v1/redirect-method/301", {
  "method": "POST",
  "headers": {
    "Content-Type": "text/plain"
  },
  "body": "fixed",
  "redirect": "follow"
});
console.log(response.status, await response.text());
Scroll horizontally to read any long lines.
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);
Scroll horizontally to read any long lines.

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