OAuthomatic::Internal::Util

- NAME
- VERSION
- DESCRIPTION
- EXPORTS FUNCTIONS
  - fill_httpmsg_form($http_message, $params)
  - parse_http_msg_form($http_message, $:force_form)
  - fill_httpmsg_text($http_message, $text, $content_type)
  - serialize_json($json)
  - fill_httpmsg_json($http_message, $json)
  - parse_http_msg_json($http_message, $:force)
- AUTHOR
- COPYRIGHT AND LICENSE

# NAME

OAuthomatic::Internal::Util - internal helper routines (form parsing and filling)

# VERSION

version 0.02

# DESCRIPTION

Internally used by OAuthomatic

# EXPORTS FUNCTIONS

## fill_httpmsg_form($http_message, $params)

Serializes $params (dict ref) as form data and sets $http_message (HTTP::Request or HTTP::Response) content with that data.

## parse_http_msg_form($http_message, $:force_form)

Parses content as message, returns hashref (empty if parsing failed, content type is not parseable etc). Supports a few content types (as HTTP::Body).

With $force_form parses also things with incorrect content type.

## fill_httpmsg_text($http_message, $text, $content_type)

Fills given HTTP::Message content with given text, using encoding specified inside content type to serialize if text is provided as perl unicode string (and appending text as is if it is binary string).

Set's also content_type (here it should be full, with charset).

$text can also be specified as reference to string.

## serialize_json($json)

Serializes JSON to utf-8 encoded string. If $json is already string or string-ref, leaves it as is.

Function defined to keep conventions in one place.

## fill_httpmsg_json($http_message, $json)

Serializes $params (dict ref) as json data and sets $http_message (HTTP::Request or HTTP::Response) content with that data.

In case $json is already scalar or scalar ref, passes it on assuming it is already serialized.

## parse_http_msg_json($http_message, $:force)

Parses content as message, returns hashref (empty if parsing failed, content type is not parseable etc).

With $force parses also things with incorrect content type.

# AUTHOR

Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Marcin Kasperski.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.