Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit bfa4cb0

Browse files
committed
Merge branch 'hotfix/142'
Close #142
2 parents fe846d3 + f5153a5 commit bfa4cb0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ All notable changes to this project will be documented in this file, in reverse
2525
removes attributes with `null` values when calling `withoutAttribute()`.
2626
- [#132](https://github.com/zendframework/zend-diactoros/pull/132) updates the
2727
`ServerRequestFactory` to marshal the request path fragment, if present.
28+
- [#142](https://github.com/zendframework/zend-diactoros/pull/142) updates the
29+
exceptions thrown by `HeaderSecurity` to include the header name and/or
30+
value.
2831

2932
## 1.3.3 - 2016-01-04
3033

src/HeaderSecurity.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ public static function isValid($value)
130130
public static function assertValid($value)
131131
{
132132
if (! self::isValid($value)) {
133-
throw new InvalidArgumentException('Invalid header value');
133+
throw new InvalidArgumentException(sprintf(
134+
'"%s" is not valid header value',
135+
$value
136+
));
134137
}
135138
}
136139

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

0 commit comments

Comments
 (0)