Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > HTTP

Other HTTP Verbs (PATCH, DELETE, ...)

Scroll Prev Top Next More

Added November 20242

To create an HTTP request using a method not explicitly supported by the XHTTPF_xxx flags, you can add a special custom header "Verb: xxxxxx", where xxxxxx is any valid HTTP verb, e.g. "Verb: PATCH", to replace the HTTP method.

Building on the example in Customizing POST headers, if you insert the "Verb: PATCH" header into the request, e.g.

Content-Type: application/json; charset=utf-8

Authorization: Basic YWdlYmFwaTpCN2VyQDhhYw==

Verb: PATCH

 

<body of request here>

 

... and submit it using XHTTPF_REQPOST + XHTTPF_HDRBODY + XHTTPF_FILEREQ, the resulting request will start with the PATCH method/verb instead of POST, e.g.

PATCH /my/web/service HTTP/1.1

Host: mydomain.com

Content-Type: application/json; charset="utf-8"

Authorization: Basic YWdlYmFwaTpCN2VyQDhhYw==

Content-Length: 84

 

<body of request here>

 

Note that the only effect of the Verb: PATCH header was to replace the first token in the raw request above (previously POST) with the new verb PATCH.

This works with both HTTPF_REQPOST and HTTPF_REQGETX flags; in either case XHTTPF_HDRBODY is required.

History

2022 June, Ashnet 1.14.182  Support for the Verb: xxxxxx custom header added. Note that the code implementing this is entirely within the Ashnet library, which can be updated independently of the A-Shell executable.