Support arbitrary content types in HTTP request and response.

By default, application/json is the only allowed type.

Add corresponding testing code.