fixing tests

This commit is contained in:
leif stawnyczy 2024-08-09 14:12:44 -04:00
parent a668a1b08b
commit 6eb8d3e236
6 changed files with 17 additions and 9 deletions

View File

@ -73,7 +73,9 @@ public interface IHttpClient {
void addHeadersToRequest(IHttpRequest theRequest, EncodingEnum theEncodingEnum, FhirContext theContext);
/**
* Updates the client's url;
* Updates the client's url, as well as the conditional create/update strings/params
* (ie, the "if None Exists" stuff)
*
* This is used when we reuse a client for multiple different requests
* (ex, searches, or fetching the /metadata endpoint followed by whatever
* the actual endpoint is, etc).
@ -81,5 +83,5 @@ public interface IHttpClient {
* Deprecated / Legacy clients do not use this (they create new clients for
* every request)
*/
void setNewUrl(StringBuilder theUrl);
void setNewUrl(StringBuilder theUrl, String theIfNoneExistsString, Map<String, List<String>> theIfNoneExistsParams);
}

View File

@ -143,8 +143,10 @@ public class OkHttpRestfulClient implements IHttpClient {
}
@Override
public void setNewUrl(StringBuilder theUrl) {
public void setNewUrl(StringBuilder theUrl, String theIfNoneExistString, Map<String, List<String>> theIfNoneExistParams) {
myUrl = theUrl;
myIfNoneExistString = theIfNoneExistString;
myIfNoneExistParams = theIfNoneExistParams;
}
private void addHeadersToRequest(

View File

@ -38,8 +38,8 @@ import java.util.Map;
public abstract class BaseHttpClient implements IHttpClient {
private final List<Header> myHeaders;
private final Map<String, List<String>> myIfNoneExistParams;
private final String myIfNoneExistString;
private Map<String, List<String>> myIfNoneExistParams;
private String myIfNoneExistString;
protected RequestTypeEnum myRequestType;
protected StringBuilder myUrl;
@ -60,8 +60,10 @@ public abstract class BaseHttpClient implements IHttpClient {
}
@Override
public void setNewUrl(StringBuilder theUrl) {
public void setNewUrl(StringBuilder theUrl, String theIfNoneExistString, Map<String, List<String>> theIfNoneExistParams) {
myUrl = theUrl;
myIfNoneExistString = theIfNoneExistString;
myIfNoneExistParams = theIfNoneExistParams;
}
private void addHeaderIfNoneExist(IHttpRequest result) {

View File

@ -99,7 +99,7 @@ public abstract class BaseHttpClientInvocation {
if (theParameters.getClient() != null) {
// reuse existing client
httpClient = theParameters.getClient();
httpClient.setNewUrl(new StringBuilder(theParameters.getUrl()));
httpClient.setNewUrl(new StringBuilder(theParameters.getUrl()), null, null);
} else {
// make a new client
httpClient = getRestfulClientFactory()

View File

@ -145,7 +145,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
httpClient = theParams.getClient();
// update the url to the one we want (in case the
// previous client did not have the correct one
httpClient.setNewUrl(url);
httpClient.setNewUrl(url, myIfNoneExistString, myIfNoneExistParams);
} else {
// make a new one
httpClient = getRestfulClientFactory()

View File

@ -166,8 +166,10 @@ public class JaxRsHttpClient implements IHttpClient {
}
@Override
public void setNewUrl(StringBuilder theUrl) {
public void setNewUrl(StringBuilder theUrl, String theIfNoneExistString, Map<String, List<String>> theIfNoneExistParams) {
myUrl = theUrl;
myIfNoneExistString = theIfNoneExistString;
myIfNoneExistParams = theIfNoneExistParams;
}
public void addHeadersToRequest(JaxRsHttpRequest theHttpRequest, EncodingEnum theEncoding, FhirContext theContext) {