Skip to content

Commit faf8fc5

Browse files
committed
Improve test and check all Authorization header (without realm)
1 parent e073003 commit faf8fc5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/src/test/java/org/asynchttpclient/oauth/OAuthSignatureCalculatorTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.asynchttpclient.oauth;
1717

18+
import static io.netty.handler.codec.http.HttpHeaders.Names.AUTHORIZATION;
1819
import static org.asynchttpclient.Dsl.*;
1920
import static org.testng.Assert.*;
2021

@@ -277,7 +278,7 @@ public void testGetWithRequestBuilderAndQuery() {
277278
//signature: tR3+Ty81lMeYAr/Fid0kMTYa/WM=
278279
//Authorization header: OAuth realm="",oauth_version="1.0",oauth_consumer_key="dpf43f3p2l4k3l03",oauth_token="nnch734d00sl2jdk",oauth_timestamp="1191242096",oauth_nonce="kllo9940pd9333jh",oauth_signature_method="HMAC-SHA1",oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D"
279280

280-
String authHeader = req.getHeaders().get("Authorization");
281+
String authHeader = req.getHeaders().get(AUTHORIZATION);
281282
Matcher m = Pattern.compile("oauth_signature=\"(.+?)\"").matcher(authHeader);
282283
assertEquals(m.find(), true);
283284
String encodedSig = m.group(1);
@@ -290,6 +291,7 @@ public void testGetWithRequestBuilderAndQuery() {
290291

291292
assertEquals(sig, "tR3+Ty81lMeYAr/Fid0kMTYa/WM=");
292293
assertEquals(req.getUrl(), "http://photos.example.net/photos?file=vacation.jpg&size=original");
294+
assertEquals(authHeader, "OAuth oauth_consumer_key=\"dpf43f3p2l4k3l03\", oauth_token=\"nnch734d00sl2jdk\", oauth_signature_method=\"HMAC-SHA1\", oauth_signature=\"tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D\", oauth_timestamp=\"1191242096\", oauth_nonce=\"kllo9940pd9333jh\", oauth_version=\"1.0\"");
293295
}
294296

295297
@Test(groups = "standalone")

0 commit comments

Comments
 (0)