Added url params before making the connection
Renamed method to keep consistency
This commit is contained in:
1 parent
8e23e81c57
commit
40bb525374
3 files changed
+6
-5
No files matched your search
@@ -61,9 +61,10 @@ class Request
|
||||
|
||||
private void createConnection() throws IOException
|
||||
{
|
||||
String effectiveUrl = URLUtils.appendParametersToQueryString(url, querystringParams);
|
||||
if (connection == null)
|
||||
{
|
||||
connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection = (HttpURLConnection) new URL(effectiveUrl).openConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ class Request
|
||||
* @param key the parameter name
|
||||
* @param value the parameter value
|
||||
*/
|
||||
public void addQuerystringParam(String key, String value)
|
||||
public void addQuerystringParameter(String key, String value)
|
||||
{
|
||||
this.querystringParams.put(key, value);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class OAuth20ServiceImpl implements OAuthService
|
||||
*/
|
||||
public void signRequest(Token accessToken, OAuthRequest request)
|
||||
{
|
||||
request.addQuerystringParam(OAuthConstants.ACCESS_TOKEN, accessToken.getToken());
|
||||
request.addQuerystringParameter(OAuthConstants.ACCESS_TOKEN, accessToken.getToken());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,8 +69,8 @@ public class RequestTest
|
||||
public void shouldAllowAddingQuerystringParametersAfterCreation()
|
||||
{
|
||||
Request request = new Request(Verb.GET, "http://example.com?one=val");
|
||||
request.addQuerystringParam("two", "other val");
|
||||
request.addQuerystringParam("more", "params");
|
||||
request.addQuerystringParameter("two", "other val");
|
||||
request.addQuerystringParameter("more", "params");
|
||||
assertEquals(3, request.getQueryStringParams().size());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user