Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 611 Bytes

README.md

File metadata and controls

37 lines (24 loc) · 611 Bytes

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