Skip to content

http: more human friendly request body #902

@oncilla

Description

@oncilla

First of all, thank you for the great library.

We are using the https://godoc.org/go.uber.org/zap#AtomicLevel.ServeHTTP endpoint for setting the log levels dynamically.

For operators, this is a bit cumbersome, because they have to specify a valid JSON object.

By default, curl uses application/x-www-form-urlencoded as the content type in a PUT request.
I think it would be nice to accept that as content type in ServeHTTP because it is a lot easier to type.
Following would be the command to set the logging level to debug:

curl -X PUT localhost:3000/log/level -d level=debug

If the content type is not application/x-www-form-urlencoded just keep the previous behavior, and expect a JSON payload.

If this is something that would be accepted, I'm be happy to work on this.
I'm just not sure if this qualifies as a breaking change or not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions