From: Rudi Grinberg Date: Sun, 9 Jan 2022 05:23:09 +0000 (-0700) Subject: add PATCH http method X-Git-Tag: 0.99~1931 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=16a62262272cdf420c27e3febe9bfb0bc3fbc932 add PATCH http method ps-id: 4B1F8D46-147C-4C89-8318-074F328E564D --- diff --git a/basis/http/client/client-docs.factor b/basis/http/client/client-docs.factor index d846693adb..d0645ee88d 100644 --- a/basis/http/client/client-docs.factor +++ b/basis/http/client/client-docs.factor @@ -124,6 +124,17 @@ HELP: http-options* { http-options http-options* } related-words +HELP: http-patch +{ $values { "url" { $or url string } } { "response" response } { "data" sequence } } +{ $description "Submits an HTTP PATCH request." } +{ $errors "Throws an error if the HTTP request fails." } ; + +HELP: http-patch* +{ $values { "url" { $or url string } } { "response" response } { "data" sequence } } +{ $description "Submits an HTTP PATCH request, but does not check the HTTP response code for success." } ; + +{ http-patch http-patch* } related-words + HELP: http-trace { $values { "url" "a " { $link url } " or " { $link string } } { "response" response } { "data" sequence } } { $description "Submits an HTTP TRACE request." } diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor index b0bad5ff61..236a203bc8 100644 --- a/basis/http/client/client.factor +++ b/basis/http/client/client.factor @@ -335,6 +335,15 @@ PRIVATE> : http-options* ( url -- response data ) http-request* ; +: ( url -- request ) + "PATCH" ; + +: http-patch ( url -- response data ) + http-request ; + +: http-patch* ( url -- response data ) + http-request* ; + : ( url -- request ) "TRACE" ; diff --git a/basis/http/parsers/parsers.factor b/basis/http/parsers/parsers.factor index dab80d9f21..8273d55339 100644 --- a/basis/http/parsers/parsers.factor +++ b/basis/http/parsers/parsers.factor @@ -36,7 +36,7 @@ IN: http.parsers [ token ] map choice ; : http-method-parser ( -- parser ) - { "OPTIONS" "GET" "HEAD" "POST" "PUT" "DELETE" "TRACE" "CONNECT" } one-of ; + { "OPTIONS" "GET" "HEAD" "POST" "PUT" "DELETE" "TRACE" "CONNECT" "PATCH" } one-of ; : url-parser ( -- parser ) [ " \t\r\n" member? ] except repeat1 case-sensitive ;