mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-17 01:32:37 +02:00
doc updates
This commit is contained in:
@ -202,11 +202,66 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p
|
$ curl --head www.example.com | jc --curl-head -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"type": "response",
|
||||||
|
"response_version": "HTTP/1.1",
|
||||||
|
"response_status": 200,
|
||||||
|
"response_reason": [
|
||||||
|
"OK"
|
||||||
|
],
|
||||||
|
"accept-ranges": [
|
||||||
|
"bytes"
|
||||||
|
],
|
||||||
|
"age": 241144,
|
||||||
|
"cache-control": [
|
||||||
|
"max-age=604800"
|
||||||
|
],
|
||||||
|
"content-type": "text/html; charset=UTF-8",
|
||||||
|
"date": "Sun, 04 Feb 2024 23:26:29 GMT",
|
||||||
|
"etag": "\"3147526947\"",
|
||||||
|
"expires": "Sun, 11 Feb 2024 23:26:29 GMT",
|
||||||
|
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||||
|
"server": [
|
||||||
|
"ECS (sac/2508)"
|
||||||
|
],
|
||||||
|
"x-cache": "HIT",
|
||||||
|
"content-length": 1256,
|
||||||
|
"date_epoch_utc": 1707089189,
|
||||||
|
"expires_epoch_utc": 1707693989,
|
||||||
|
"last-modified_epoch_utc": 1571296706
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p -r
|
$ curl --head www.example.com | jc --curl-head -p -r
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"type": "response",
|
||||||
|
"response_version": "HTTP/1.1",
|
||||||
|
"response_status": 200,
|
||||||
|
"response_reason": [
|
||||||
|
"OK"
|
||||||
|
],
|
||||||
|
"accept-ranges": [
|
||||||
|
"bytes"
|
||||||
|
],
|
||||||
|
"age": "225102",
|
||||||
|
"cache-control": [
|
||||||
|
"max-age=604800"
|
||||||
|
],
|
||||||
|
"content-type": "text/html; charset=UTF-8",
|
||||||
|
"date": "Sun, 04 Feb 2024 23:28:17 GMT",
|
||||||
|
"etag": "\"3147526947\"",
|
||||||
|
"expires": "Sun, 11 Feb 2024 23:28:17 GMT",
|
||||||
|
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||||
|
"server": [
|
||||||
|
"ECS (sac/2575)"
|
||||||
|
],
|
||||||
|
"x-cache": "HIT",
|
||||||
|
"content-length": "1256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
<a id="jc.parsers.curl_head.parse"></a>
|
<a id="jc.parsers.curl_head.parse"></a>
|
||||||
|
|
||||||
|
@ -207,11 +207,88 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p
|
$ cat headers.txt | jc --http-headers -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p -r
|
$ cat headers.txt | jc --http-headers -p -r
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
<a id="jc.parsers.http_headers.parse"></a>
|
<a id="jc.parsers.http_headers.parse"></a>
|
||||||
|
|
||||||
|
@ -197,11 +197,66 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p
|
$ curl --head www.example.com | jc --curl-head -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"type": "response",
|
||||||
|
"response_version": "HTTP/1.1",
|
||||||
|
"response_status": 200,
|
||||||
|
"response_reason": [
|
||||||
|
"OK"
|
||||||
|
],
|
||||||
|
"accept-ranges": [
|
||||||
|
"bytes"
|
||||||
|
],
|
||||||
|
"age": 241144,
|
||||||
|
"cache-control": [
|
||||||
|
"max-age=604800"
|
||||||
|
],
|
||||||
|
"content-type": "text/html; charset=UTF-8",
|
||||||
|
"date": "Sun, 04 Feb 2024 23:26:29 GMT",
|
||||||
|
"etag": "\"3147526947\"",
|
||||||
|
"expires": "Sun, 11 Feb 2024 23:26:29 GMT",
|
||||||
|
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||||
|
"server": [
|
||||||
|
"ECS (sac/2508)"
|
||||||
|
],
|
||||||
|
"x-cache": "HIT",
|
||||||
|
"content-length": 1256,
|
||||||
|
"date_epoch_utc": 1707089189,
|
||||||
|
"expires_epoch_utc": 1707693989,
|
||||||
|
"last-modified_epoch_utc": 1571296706
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p -r
|
$ curl --head www.example.com | jc --curl-head -p -r
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"type": "response",
|
||||||
|
"response_version": "HTTP/1.1",
|
||||||
|
"response_status": 200,
|
||||||
|
"response_reason": [
|
||||||
|
"OK"
|
||||||
|
],
|
||||||
|
"accept-ranges": [
|
||||||
|
"bytes"
|
||||||
|
],
|
||||||
|
"age": "225102",
|
||||||
|
"cache-control": [
|
||||||
|
"max-age=604800"
|
||||||
|
],
|
||||||
|
"content-type": "text/html; charset=UTF-8",
|
||||||
|
"date": "Sun, 04 Feb 2024 23:28:17 GMT",
|
||||||
|
"etag": "\"3147526947\"",
|
||||||
|
"expires": "Sun, 11 Feb 2024 23:28:17 GMT",
|
||||||
|
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
|
||||||
|
"server": [
|
||||||
|
"ECS (sac/2575)"
|
||||||
|
],
|
||||||
|
"x-cache": "HIT",
|
||||||
|
"content-length": "1256"
|
||||||
|
}
|
||||||
|
]
|
||||||
"""
|
"""
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
from jc.jc_types import JSONDictType
|
from jc.jc_types import JSONDictType
|
||||||
|
@ -202,11 +202,88 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p
|
$ cat headers.txt | jc --http-headers -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
$ curl-head | jc --curl-head -p -r
|
$ cat headers.txt | jc --http-headers -p -r
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
"""
|
"""
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
from jc.jc_types import JSONDictType
|
from jc.jc_types import JSONDictType
|
||||||
|
@ -8,6 +8,10 @@ from tests import utils_for_test as test_utils
|
|||||||
# - `{parser_name}--{some_test_description}.out` for command output.
|
# - `{parser_name}--{some_test_description}.out` for command output.
|
||||||
# - `{parser_name}--{some_test_description}.json` for expected JSON after parsing.
|
# - `{parser_name}--{some_test_description}.json` for expected JSON after parsing.
|
||||||
|
|
||||||
|
# create output with:
|
||||||
|
# curl -ILvs http://google.com 2> curl_head--ILvs-google-com.out
|
||||||
|
# cat curl_head--ILvs-google-com.out | jc --curl-head > curl_head--ILvs-google-com.json
|
||||||
|
|
||||||
class MyTests(unittest.TestCase):
|
class MyTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_curl_head_nodata(self):
|
def test_curl_head_nodata(self):
|
||||||
|
Reference in New Issue
Block a user