Skip to content

Latest commit

 

History

History

requestbodyvar

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

requestbodyvar

A Caddy v2 extension to add support for the {http.request.body.*} placeholder (variable).

Installation

$ xcaddy build --with github.com/RussellLuo/caddy-ext/requestbodyvar

Example

With the following Caddyfile:

localhost:8080 {
    route / {
        request_body_var

        respond {http.request.body.name}
    }
}

You can get the responses as below:

$ curl -XPOST https://localhost:8080 -d '{"name":"caddy"}'
caddy
$ curl -XPOST https://localhost:8080 -d '{"name":"wow"}'
wow