Module arbiter
Handles content negotiation with the client.
Info:
- License: Unlicense
- Author: DarkWiiPlayer
Functions
| new (accept) | Parses an “accept” header and returns its entries. |
| pick (available, ...) | Picks the client’s preferred content type from a list. |
Local Functions
| patescape (pattern) | Escapes all the special pattern characters in a string |
| pattern (accept) | Takes a content type string and turns the string into patterns to match said type(s) |
Functions
- new (accept)
-
Parses an “accept” header and returns its entries.
Values are returned as:
{q = <Q-Value>, s = <Specificity>, type = <content type>}where specificity can be 1 for/, 2 for<type>/*or 3 for<type>/<subtype>Parameters:
- accept string The full HTTP Accept header
- pick (available, ...)
-
Picks the client’s preferred content type from a list.
When given a list of strings as arguments or in a sequence, the best match will be returned.
When given a table, the keys will be treated as content types
and the selected type will be returned along with its corresponding value.
Parameters:
- available
- ...