# Module cloudi_request_info

- Description
- Data Types
- Function Index
- Function Details

### CloudI RequestInfo Creation and Parsing

RequestInfo is used for request meta-data which is normally key/value pairs that describe the context of the service request (e.g., HTTP header names and values for a HTTP request). The default encoding provided below is a basic format for textual key/value data (i.e., neither the key or value should contain a null character, '\0') which is easily parsed in any programming language and is referred to as the 'text_pairs' format. It is valid to have multiple entries for the same key within the RequestInfo data. A key must be of size 1 or greater (`<<>>` will never exist as a key in text_pairs data).

.

Copyright © 2014-2020 Michael Truog

Version: 2.0.1 Dec 3 2021 17:15:35 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### CloudI RequestInfo Creation and Parsing

RequestInfo is used for request meta-data which is normally key/value pairs that describe the context of the service request (e.g., HTTP header names and values for a HTTP request). The default encoding provided below is a basic format for textual key/value data (i.e., neither the key or value should contain a null character, '\0') which is easily parsed in any programming language and is referred to as the 'text_pairs' format. It is valid to have multiple entries for the same key within the RequestInfo data. A key must be of size 1 or greater (`<<>>` will never exist as a key in text_pairs data).

Use the 'binary_pairs' format if any of the key/value data is binary data (i.e., if any of the key or value data contains null characters, '\0').

The ResponseInfo data is normally service request response meta-data (providing the response equivalent of RequestInfo for a request) and can utilize the same functions below.

These module functions provide Erlang serialization of the 'text_pairs' format and the 'binary_pairs' format for use with the cloudi_key_value module.

## Data Types

### format()

`format() = text_pairs | binary_pairs`

## Function Index

key_value_append/2 | #### Append RequestInfo key/value data. Use the same binary format.
key_value_new/1 | #### New RequestInfo key/value data. RequestInfo is meant to contain key/value pairs that is request meta-data.
key_value_new/2 | #### New RequestInfo key/value data. RequestInfo is meant to contain key/value pairs that is request meta-data.
key_value_parse/1 | #### Parse RequestInfo key/value data. RequestInfo is meant to contain key/value pairs that is request meta-data.
key_value_parse/2 | #### Parse RequestInfo key/value data to the return type specified. RequestInfo is meant to contain key/value pairs that is request meta-data.

## Function Details

### key_value_append/2

`key_value_append(RequestInfo::cloudi_key_value:key_values(), Existing::binary()) -> Result::binary()`

#### Append RequestInfo key/value data.

Use the same binary format.

### key_value_new/1

`key_value_new(RequestInfo::cloudi_key_value:key_values()) -> Result::binary()`

#### New RequestInfo key/value data.

RequestInfo is meant to contain key/value pairs that is request meta-data. Create the binary RequestInfo data with any supported data structure.

### key_value_new/2

`key_value_new(RequestInfo::cloudi_key_value:key_values(), Format::format()) -> Result::binary()`

#### New RequestInfo key/value data.

RequestInfo is meant to contain key/value pairs that is request meta-data. Create the binary RequestInfo data with any supported data structure.

### key_value_parse/1

`key_value_parse(RequestInfo::binary() | cloudi_key_value:key_values()) -> Result::#{cloudi_key_value:key() := cloudi_key_value:value()}`

#### Parse RequestInfo key/value data.

RequestInfo is meant to contain key/value pairs that is request meta-data.

### key_value_parse/2

`key_value_parse(RequestInfo::binary() | cloudi_key_value:key_values(), ResultType::map | list) -> Result::#{cloudi_key_value:key() := cloudi_key_value:value()} | [{cloudi_key_value:key(), cloudi_key_value:value()}]`

#### Parse RequestInfo key/value data to the return type specified.

RequestInfo is meant to contain key/value pairs that is request meta-data.

Generated by EDoc