Skip to content
jc-rs
GitHub

http-headers

--http-headersv1.1.0

Converts HTTP request/response headers to JSON

LinuxmacOSWindowsstring
$ cat input.txt | jc-rs --http-headers

A real pair

From the reference corpus (generic/http_headers--example-com.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

http_headersgeneric
HEAD / HTTP/1.1
Host: example.com
User-Agent: curl/8.1.2
Accept: */*

HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 140203
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Sun, 04 Feb 2024 02:25:07 GMT
Etag: "3147526947"
Expires: Sun, 11 Feb 2024 02:25:07 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (sac/252F)
X-Cache: HIT
Content-Length: 1256
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "_type": "request",
    "_request_method": "HEAD",
    "_request_uri": "/",
    "_request_version": "HTTP/1.1",
    "host": "example.com",
    "user-agent": "curl/8.1.2",
    "accept": [
      "*/*"
    ]
  },
  {
    "_type": "response",
    "_response_version": "HTTP/1.1",
    "_response_status": 200,
    "_response_reason": [
      "OK"
    ],
    "accept-ranges": [
      "bytes"
    ],
    "age": 140203,
    "cache-control": [
      "max-age=604800"
    ],
    "content-type": "text/html; charset=UTF-8",
    "date": "Sun, 04 Feb 2024 02:25:07 GMT",
    "etag": "\"3147526947\"",
    "expires": "Sun, 11 Feb 2024 02:25:07 GMT",
    "last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
    "server": [
      "ECS (sac/252F)"
    ],
    "x-cache": "HIT",
    "content-length": 1256,
    "date_epoch_utc": 1707013507,
    "expires_epoch_utc": 1707618307,
    "last-modified_epoch_utc": 1571296706
  }
]

Guides using this parser

Fixture coverage

2/2oracle-valid pairs match under the published structural JSON comparison

Magic syntax

not availableThis parser reads a file or a string rather than a command, so there is nothing for jc-rs to run. Pipe it in.

Source: crates/jc-rs-parsers/src/network/http_headers.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare