Release 1.1.1

This commit is contained in:
Vincent Prouillet 2016-03-29 16:28:57 +01:00
parent 60b511a97a
commit 92bc6b8dd4
3 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "jsonwebtoken" name = "jsonwebtoken"
version = "1.1.0" version = "1.1.1"
authors = ["Vincent Prouillet <vincent@wearewizards.io>"] authors = ["Vincent Prouillet <vincent@wearewizards.io>"]
license = "MIT" license = "MIT"
readme = "README.md" readme = "README.md"

View File

@ -6,7 +6,7 @@
Add the following to Cargo.toml: Add the following to Cargo.toml:
```toml ```toml
jsonwebtoken = "1.0" jsonwebtoken = "1"
rustc-serialize = "0.3" rustc-serialize = "0.3"
``` ```
@ -72,5 +72,6 @@ test bench_encode ... bench: 4,261 ns/iter (+/- 722)
## Changelog ## Changelog
1.1.1: Don't serialize empty fields in header
1.1.0: Impl Error for jsonwebtoken errors 1.1.0: Impl Error for jsonwebtoken errors
1.0: Initial release 1.0: Initial release

View File

@ -31,10 +31,10 @@ pub enum Algorithm {
impl ToJson for Algorithm { impl ToJson for Algorithm {
fn to_json(&self) -> Json { fn to_json(&self) -> Json {
match self { match *self {
&Algorithm::HS256 => Json::String("HS256".to_owned()), Algorithm::HS256 => Json::String("HS256".to_owned()),
&Algorithm::HS384 => Json::String("HS384".to_owned()), Algorithm::HS384 => Json::String("HS384".to_owned()),
&Algorithm::HS512 => Json::String("HS512".to_owned()), Algorithm::HS512 => Json::String("HS512".to_owned()),
} }
} }
} }
@ -109,9 +109,8 @@ impl ToJson for Header {
// Define a macro to reduce boilerplate. // Define a macro to reduce boilerplate.
macro_rules! optional { macro_rules! optional {
($field_name:ident) => ( ($field_name:ident) => (
match self.$field_name { if let Some(ref value) = self.$field_name {
Some(ref value) => { d.insert(stringify!($field_name).to_string(), value.to_json()); }, d.insert(stringify!($field_name).to_string(), value.to_json());
None => {},
} }
) )
} }