375906 Part.getHeader method not case insensitive

This commit is contained in:
Jan Bartel 2012-04-03 16:57:12 +10:00
parent 45050ebac9
commit ec77ba41ef
2 changed files with 4 additions and 2 deletions

View File

@ -170,7 +170,9 @@ public class MultiPartInputStream
*/
public String getHeader(String name)
{
return (String)_headers.getValue(name, 0);
if (name == null)
return null;
return (String)_headers.getValue(name.toLowerCase(), 0);
}
/**

View File

@ -147,7 +147,7 @@ public class MultiPartInputStreamTest extends TestCase
Part stuff = mpis.getPart("stuff");
assertEquals("text/plain", stuff.getContentType());
assertEquals("text/plain", stuff.getHeader("content-type"));
assertEquals("text/plain", stuff.getHeader("Content-Type"));
assertEquals(1, stuff.getHeaders("content-type").size());
assertEquals("form-data; name=\"stuff\"; filename=\"stuff.txt\"", stuff.getHeader("content-disposition"));
assertEquals(2, stuff.getHeaderNames().size());