You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get the content-length header while downloading an artifact from artifactory. I could see all the headers returned in the response object but content-length and content-type. Download artifact request returns all the headers when I use other clients (Postman, java httpclient, chrome browser etc).
Gradle debug log prints all the headers returned by the API but it is not the same in the response headers returned by the httpresponse object
I am not sure if jclouds has a restriction on the number of headers returned via the httpresponse object.
Expected Behavior
jclouds httpresponse object returns all the response headers
Steps to Reproduce (for bugs)
I created a pojo called DownloadContent
@AutoValue
public abstract class DownloadContent {
@Nullable
public abstract InputStream inputStream();
@Nullable
public abstract Integer contentLength();
@SerializedNames({"inputStream", "contentLength"})
public static DownloadContent create(InputStream inputStream, int contentLength) {
return new AutoValue_DownloadContent(inputStream, contentLength);
}
}
parser to parse the jclouds httpresponse object returned by the ArtifactAPI
public class InputStreamContentParser implements Function<HttpResponse, DownloadContent> {
@Override
public DownloadContent apply(HttpResponse response) {
int contentLength = 0;
Map<String, Collection<String>> headers = response.getHeaders().asMap();
if (response.getHeaders() != null && response.getHeaders().containsKey("content-length")) {
contentLength = Integer.parseInt(response.getHeaders().get("content-length").toArray()[0].toString());
}
try {
return DownloadContent.create(response.getPayload().openStream(), contentLength);
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
}
}
I am trying to get the content-length header while downloading an artifact from artifactory. I could see all the headers returned in the response object but content-length and content-type. Download artifact request returns all the headers when I use other clients (Postman, java httpclient, chrome browser etc).
Gradle debug log prints all the headers returned by the API but it is not the same in the response headers returned by the httpresponse object
I am not sure if jclouds has a restriction on the number of headers returned via the httpresponse object.
Expected Behavior
jclouds httpresponse object returns all the response headers
Steps to Reproduce (for bugs)
I created a pojo called DownloadContent
parser to parse the jclouds httpresponse object returned by the ArtifactAPI
Then I add this parser to the download API
I ran a live test on my local instance of artifactory. The following are the jclouds log returned by gradle for download request
The headers returned by the jclouds httpresponse object in
InputStreamContentParser
are as followsThe number of headers is always 15.
Your Environment
Artifactory-Version: Artifactory/7.38.10 73810900
Any help on this issue is much appreciated! Thanks!
The text was updated successfully, but these errors were encountered: