Skip to content

Commit

Permalink
Merge branch 'hotfix/142'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Mar 17, 2016
2 parents fe846d3 + f5153a5 commit bfa4cb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ All notable changes to this project will be documented in this file, in reverse
removes attributes with `null` values when calling `withoutAttribute()`.
- [#132](https://github.com/zendframework/zend-diactoros/pull/132) updates the
`ServerRequestFactory` to marshal the request path fragment, if present.
- [#142](https://github.com/zendframework/zend-diactoros/pull/142) updates the
exceptions thrown by `HeaderSecurity` to include the header name and/or
value.

## 1.3.3 - 2016-01-04

Expand Down
10 changes: 8 additions & 2 deletions src/HeaderSecurity.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ public static function isValid($value)
public static function assertValid($value)
{
if (! self::isValid($value)) {
throw new InvalidArgumentException('Invalid header value');
throw new InvalidArgumentException(sprintf(
'"%s" is not valid header value',
$value
));
}
}

Expand All @@ -144,7 +147,10 @@ public static function assertValid($value)
public static function assertValidName($name)
{
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) {
throw new InvalidArgumentException('Invalid header name');
throw new InvalidArgumentException(sprintf(
'"%s" is not valid header name',
$name
));
}
}
}

0 comments on commit bfa4cb0

Please sign in to comment.