Skip to content

Set media types for node

Context

The merge request !3683 (merged) added an optional parameter to the client that defines the media type for RPC requests.

This merge request add an optional parameter --media-type to the node that defines which media types are supported by the node. The parameter value can be json, binary or any. By default, the value is set to Any. The client can't make a request to a node with a media type that is not supported by the node.

In addition, this merge request adds a module Command_line to lib_http_rpc.Media_type with a refactor of the client media-type parameter.

Fix #1919 (closed)

Manually testing the MR

  • Run a node with a --media_type parameter json or binary
  • Make an RPC request to the node with the client with the same media-type parameter.
  • Make an RPC request to the node with the client with a media-type that shouldn't be accepted. The request must fail with the error No intersection between the media types we accept and the ones the server is able to send.
  • Run a node with the --media-type parameter Any. All (correct) requests must work properly.
Edited by Killian Delarue

Merge request reports