Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArtifactoryImpl.restCall does not support requests without Content-Type #331

Open
yaroslav-orel-jfrog opened this issue Nov 29, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@yaroslav-orel-jfrog
Copy link
Contributor

Describe the bug
Artifactory client does not support requests without Content-Type header. GET requests don't have Content-Type header and some endpoints in Artifactory do not expect this header to be provided (e.g. 'api/v1/service_trust/pairings/federated-repo/*'). As a result when executing such requests we get "message" : "Unsupported Media Type" because Client adds Content-Type: */* by default.

To Reproduce

Artifactory artifactory = ArtifactoryClientBuilder.create()
        .setUrl("ArtifactoryUrl")
        .setUsername("username")
        .setPassword("password")
        .build();
ArtifactoryRequest ar = new ArtifactoryRequestImpl()
                .method(ArtifactoryRequest.Method.GET)
                .apiUrl("api/v1/service_trust/pairings/federated-repo/*")
 artifactory.restCall(ar)

Expected behavior
Allow requests to be sent without Content-Type header

Additional context
In order not to break existing behavior, it would be safe to support requests with requestType == null. But Currently this line
ContentType contentType = Util.getContentType(artifactoryRequest.getRequestType());
throws NPE if requestType == null

@yaroslav-orel-jfrog yaroslav-orel-jfrog added the bug Something isn't working label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant