hurl/docs/grammar.md
2024-05-15 06:50:14 +00:00

102 KiB

Grammar

Definitions

Short description:

  • operator | denotes alternative,
  • operator * denotes iteration (zero or more),
  • operator + denotes iteration (one or more),

Syntax Grammar

General

hurl-file
entry(used by hurl-file)
method(used by request)
[A-Z]+
version(used by response)
 HTTP/1.0
|HTTP/1.1
|HTTP/2
|HTTP
status(used by response)
[0-9]+
header(used by requestresponse)
body(used by requestresponse)

Sections

response-section(used by response)
query-string-params-section(used by request-section)
lt*
[QueryStringParams] lt
key-value*
form-params-section(used by request-section)
lt*
[FormParams] lt
key-value*
multipart-form-data-section(used by request-section)
lt*
[MultipartFormData] lt
multipart-form-data-param*
cookies-section(used by request-section)
lt*
[Cookies] lt
key-value*
captures-section(used by response-section)
lt*
[Captures] lt
capture*
asserts-section(used by response-section)
lt*
[Asserts] lt
assert*
basic-auth-section(used by request-section)
lt*
[BasicAuth] lt
key-value*
options-section(used by request-section)
lt*
[Options] lt
option*
multipart-form-data-param(used by multipart-form-data-section)
file-value(used by file-param)
file-contenttype(used by file-value)
[a-zA-Z0-9/+-]+
capture(used by captures-section)
assert(used by asserts-section)
aws-sigv4-option(used by option)
aws-sigv4 : value-string lt
ca-certificate-option(used by option)
cacert : filename lt
client-certificate-option(used by option)
client-key-option(used by option)
key : value-string lt
compressed-option(used by option)
compressed : boolean-option lt
connect-to-option(used by option)
connect-to : value-string lt
delay-option(used by option)
delay : integer-option lt
follow-redirect-option(used by option)
location : boolean-option lt
follow-redirect-trusted-option(used by option)
location-trusted : boolean-option lt
http10-option(used by option)
http1.0 : boolean-option lt
http11-option(used by option)
http1.1 : boolean-option lt
http2-option(used by option)
http2 : boolean-option lt
http3-option(used by option)
http3 : boolean-option lt
insecure-option(used by option)
insecure : boolean-option lt
ipv4-option(used by option)
ipv4 : boolean-option lt
ipv6-option(used by option)
ipv6 : boolean-option lt
max-redirs-option(used by option)
max-redirs : integer-option lt
netrc-option(used by option)
netrc : boolean-option lt
netrc-file-option(used by option)
netrc-file : value-string lt
netrc-optional-option(used by option)
netrc-optional : boolean-option lt
output-option(used by option)
output : value-string lt
path-as-is-option(used by option)
path-as-is : boolean-option lt
proxy-option(used by option)
proxy : value-string lt
resolve-option(used by option)
resolve : value-string lt
retry-option(used by option)
retry : integer-option lt
retry-interval-option(used by option)
retry-interval : integer-option lt
skip-option(used by option)
skip : boolean-option lt
unix-socket-option(used by option)
unix-socket : value-string lt
user-option(used by option)
user : value-string lt
variable-option(used by option)
variable : variable-definition lt
verbose-option(used by option)
verbose : boolean-option lt
very-verbose-option(used by option)
very-verbose : boolean-option lt
variable-definition(used by variable-option)

Query

status-query(used by query)
status
url-query(used by query)
url
header-query(used by query)
header sp quoted-string
certificate-query(used by query)
certificate sp (Subject|Issuer|Start-Date|Expire-Date|Serial-Number)
cookie-query(used by query)
cookie sp quoted-string
body-query(used by query)
body
xpath-query(used by query)
jsonpath-query(used by query)
jsonpath sp quoted-string
regex-query(used by query)
variable-query(used by query)
variable sp quoted-string
duration-query(used by query)
duration
sha256-query(used by query)
sha256
md5-query(used by query)
md5
bytes-query(used by query)
bytes

Predicates

predicate(used by assert)
equal-predicate(used by predicate-func)
not-equal-predicate(used by predicate-func)
greater-predicate(used by predicate-func)
greater-or-equal-predicate(used by predicate-func)
less-predicate(used by predicate-func)
less-or-equal-predicate(used by predicate-func)
start-with-predicate(used by predicate-func)
end-with-predicate(used by predicate-func)
contain-predicate(used by predicate-func)
contains sp quoted-string
match-predicate(used by predicate-func)
matches sp (quoted-string|regex)
exist-predicate(used by predicate-func)
exists
is-empty-predicate(used by predicate-func)
isEmpty
include-predicate(used by predicate-func)
includes sp predicate-value
integer-predicate(used by predicate-func)
isInteger
float-predicate(used by predicate-func)
isFloat
boolean-predicate(used by predicate-func)
isBoolean
string-predicate(used by predicate-func)
isString
collection-predicate(used by predicate-func)
isCollection
date-predicate(used by predicate-func)
isDate
iso-date-predicate(used by predicate-func)
isIsoDate

Bytes

xml(used by bytes)
< To Be Defined >
base64, [A-Z0-9+-= \n]+ ;
oneline-file(used by predicate-valuebytes)
file, filename ;

Strings

quoted-string-text(used by quoted-string-content)
~["\\]+
quoted-string-escaped-char(used by quoted-string-content)
\ ("|\|\b|\f|\n|\r|\t|\u unicode-char)
key-string-content(used by key-string)
key-string-text(used by key-string-content)
(alphanum|_|-|.|[|]|@|$)+
key-string-escaped-char(used by key-string-content)
\ (#|:|\|\b|\f|\n|\r|\t|\u unicode-char)
value-string-text(used by value-string-content)
~[#\n\\]+
value-string-escaped-char(used by value-string-content)
\ (#|\|\b|\f|\n|\r|\t|\u unicode-char)
oneline-string(used by bytes)
oneline-string-text(used by oneline-string-content)
~[#\n\\] ~`
oneline-string-escaped-char(used by oneline-string-content)
\ (`|#|\|b|f|u unicode-char)
multiline-string-type(used by multiline-string)
 base64
|hex
|json
|xml
|graphql
multiline-string-text(used by multiline-string-content)
~[\\]+ ~```
multiline-string-escaped-char(used by multiline-string-content)
\ (\|b|f|n|r|t|`|u unicode-char)
filename-content(used by filename)
filename-text(used by filename-content)
~[#;{} \n\\]+
filename-escaped-char(used by filename-content)
\ (\|b|f|n|r|t|#|;| |{|}|u unicode-char)
filename-password-text(used by filename-password-content)
~[#;{} \n\\]+
filename-password-escaped-char(used by filename-password-content)
\ (\|b|f|n|r|t|#|;| |{|}|:|u unicode-char)

JSON

json-object(used by json-value)
json-key-value(used by json-object)
json-array(used by json-value)
[ json-value (, json-value)* ]
json-string(used by json-valuejson-key-value)
json-string-text(used by json-string-content)
~["\\]
json-string-escaped-char(used by json-string-content)
\ ("|\|b|f|n|r|t|u hexdigit hexdigit hexdigit hexdigit)
json-number(used by json-value)

Template / Expression

expr(used by template)
variable-name(used by variable-definitionexpr)
[A-Za-z] [A-Za-z_-0-9]*

Filter

count-filter(used by filter)
count
days-after-now-filter(used by filter)
daysAfterNow
days-before-now-filter(used by filter)
daysBeforeNow
decode-filter(used by filter)
decode
format-filter(used by filter)
format
html-escape-filter(used by filter)
htmlEscape
html-unescape-filter(used by filter)
htmlUnescape
jsonpath-filter(used by filter)
jsonpath sp quoted-string
nth-filter(used by filter)
nth sp integer
regex-filter(used by filter)
replace-filter(used by filter)
split-filter(used by filter)
to-date-filter(used by filter)
toDate
to-float-filter(used by filter)
toFloat
to-int-filter(used by filter)
toInt
url-decode-filter(used by filter)
urlDecode
url-encode-filter(used by filter)
urlEncode
xpath-filter(used by filter)

Lexical Grammar

true|false
alphanum(used by key-string-text)
[A-Za-z0-9]
digit(used by integerfractionexponent)
[0-9]
[0-9A-Fa-f]
fraction(used by json-numberfloat)
. digit+
exponent(used by json-number)
(e|E) (+|-)? digit+
lt(used by hurl-filerequestresponseheaderbodyquery-string-params-sectionform-params-sectionmultipart-form-data-sectioncookies-sectioncaptures-sectionasserts-sectionbasic-auth-sectionoptions-sectionfile-paramcaptureassertoptionaws-sigv4-optionca-certificate-optionclient-certificate-optionclient-key-optioncompressed-optionconnect-to-optiondelay-optionfollow-redirect-optionfollow-redirect-trusted-optionhttp10-optionhttp11-optionhttp2-optionhttp3-optioninsecure-optionipv4-optionipv6-optionmax-redirs-optionnetrc-optionnetrc-file-optionnetrc-optional-optionoutput-optionpath-as-is-optionproxy-optionresolve-optionretry-optionretry-interval-optionskip-optionunix-socket-optionuser-optionvariable-optionverbose-optionvery-verbose-optionmultiline-string)
sp* comment? [\n]?
comment(used by lt)
# ~[\n]*
regex-content(used by regex)
regex-text(used by regex-content)
~[\n\/]+
regex-escaped-char(used by regex-content)
\ ~[\n]