POST /... appends all array elements

Matt Holt 2019-12-17 10:10:08 -07:00
parent 8738e6ee97
commit 9801536787

@ -345,15 +345,30 @@ $ curl "http://localhost:2019/config/apps/http/servers/myserver/listen"
Changes Caddy's configuration at the named scope to the JSON body of the request. If the named scope is an array, POST appends; if an object, it creates or replaces. Changes Caddy's configuration at the named scope to the JSON body of the request. If the named scope is an array, POST appends; if an object, it creates or replaces.
### Example As a special case, many items can be added to an array if:
1. the path ends in `/...`
2. the second-to-last element of the path refers to an array
3. the payload is an array
In this case, the elements in the payload's array will be expanded, and each one will be appended to the destination array.
### Examples
```bash ```bash
$ curl -X POST \ $ curl -X POST \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '":2080"' \ -d '":8080"' \
"http://localhost:2019/config/apps/http/servers/myserver/listen" "http://localhost:2019/config/apps/http/servers/myserver/listen"
``` ```
```bash
$ curl -X POST \
-H "Content-Type: application/json" \
-d '[":8080", ":5133"]' \
"http://localhost:2019/config/apps/http/servers/myserver/listen/..."
```
## PUT /config/[scope] ## PUT /config/[scope]