Skip to content

Commit

Permalink
[http-client] Ignore case while searching for header by name (#5642)
Browse files Browse the repository at this point in the history
  • Loading branch information
uarlouski authored Jan 6, 2025
1 parent 2fcf0ca commit 7f092b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2024 the original author or authors.
* Copyright 2019-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@ public Optional<Header> getHeaderByName(String headerName)

public Stream<Header> getHeadersByName(String headerName)
{
return Stream.of(responseHeaders).filter(header -> header.getName().equals(headerName));
return Stream.of(responseHeaders).filter(header -> header.getName().equalsIgnoreCase(headerName));
}

public String getMethod()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 the original author or authors.
* Copyright 2019-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,6 +73,7 @@ void testGetHeaderByName()
Header[] headers = { header };
httpResponse.setResponseHeaders(headers);
assertEquals(Optional.of(header), httpResponse.getHeaderByName(HEADER_NAME));
assertEquals(Optional.of(header), httpResponse.getHeaderByName("NaMe"));
}

@Test
Expand Down

0 comments on commit 7f092b8

Please sign in to comment.