plumbapius v0.13.0 Plumbapius.ContentType

Defines functions for the request content-type

Link to this section Summary

Functions

Converts a request content-type from a schema to a regular expression.

Link to this section Functions

Link to this function

convert_for_schema(content_type_schema)

Specs

convert_for_schema(String.t() | nil) ::
  Regex.t() | String.t() | :any_content_type

Converts a request content-type from a schema to a regular expression.

Parameters

  • request_content_type_schema: Request content-type for conversion.

Examples

iex> Plumbapius.ContentType.convert_for_schema(nil)
:any_content_type

iex> Plumbapius.ContentType.convert_for_schema("application/json")
"application/json"

iex> Plumbapius.ContentType.convert_for_schema("multipart/mixed; boundary={boundary}")
~r/\Amultipart\/mixed; boundary=[^\s]+\z/
Link to this function

match?(content_type, schema_content_type)

Specs

match?(String.t() | nil, Regex.t() | String.t() | :any_content_type) ::
  boolean()