Popularity
3.0
Declining
Activity
0.0
Stable
14
1
4

Monthly Downloads: 1,216
Programming language: Elixir
License: http://opensource.org/licenses/MIT
Tags: HTTP    
Latest version: v1.1.1

uri_template alternatives and similar packages

Based on the "HTTP" category

Do you think we are missing an alternative of uri_template or a related project?

Add another 'HTTP' Package

README

UriTemplate

Build Status Hex.pm

RFC 6570 compliant (level 3) URI template processor.

Usage

iex> UriTemplate.expand("http://example.com/{id}", id: 42)
"http://example.com/42"

iex> tmpl = UriTemplate.from_string "http://example.com/{id}"
...> UriTemplate.expand(tmpl,  id: 42)
"http://example.com/42"
...> UriTemplate.expand(tmpl,  id: 84)
"http://example.com/84"

iex> UriTemplate.expand("http://example.com?q={terms}", terms: "fiz buzz")
"http://example.com?q=fiz%20buzz"

iex> UriTemplate.expand("http://example.com?q={terms}", terms: ["fiz", "buzz"])
"http://example.com?q=fiz,buzz"

iex> UriTemplate.expand("http://example.com?{k}", k: [one: 1, two: 2])
"http://example.com?one,1,two,2"

iex> UriTemplate.expand("http://example.com/test", id: 42)
"http://example.com/test"

iex> UriTemplate.expand("http://example.com/{lat,lng}", lat: 40, lng: -105)
"http://example.com/40,-105"

iex> UriTemplate.expand("http://example.com/{;lat,lng}", lat: 40, lng: -105)
"http://example.com/;lat=40;lng=-105"

iex> UriTemplate.expand("http://example.com/{?lat,lng}", lat: 40, lng: -105)
"http://example.com/?lat=40&lng=-105"

iex> UriTemplate.expand("http://example.com/?test{&lat,lng}", lat: 40, lng: -105)
"http://example.com/?test&lat=40&lng=-105"

iex> UriTemplate.expand("http://example.com{/lat,lng}", lat: 40, lng: -105)
"http://example.com/40/-105"

iex> UriTemplate.expand("http://example.com/test{.fmt}", fmt: "json")
"http://example.com/test.json"

iex> UriTemplate.expand("http://example.com{#lat,lng}", lat: 40, lng: -105)
"http://example.com#40,-105"

iex> UriTemplate.expand("http://example.com/{longstr:6}", longstr: "thisisquitealongstring")
"http://example.com/thisis"

Installation

Add the following to your project :deps list:

{:uri_template, "~>1.0"}

Contributing

To run the tests:

mix deps.get
git submodule update --init
mix test