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

[Bug]: Rest Connection does not work without credentials #4758

Open
fhossfel opened this issue Jan 6, 2025 · 1 comment
Open

[Bug]: Rest Connection does not work without credentials #4758

fhossfel opened this issue Jan 6, 2025 · 1 comment
Assignees
Labels
Milestone

Comments

@fhossfel
Copy link

fhossfel commented Jan 6, 2025

Apache Hop version?

2.11

Java version?

17.0.13

Operating system

macOS

What happened?

I was trying to use the Rest Connection without any authorization. It fails with an error 400. The source of the error seems to be that an empty authorization header is sent even when all the authorization fields are not set. It seems that api.openligadb.de does not like this and fails with an error 400.

The error is in org.apache.hop.metadata.rest.RestClient, l. 89:

if (!StringUtils.isEmpty(authorizationPrefix)) {
  invocationBuilder.header(
      authorizationHeaderName, authorizationPrefix + " " + authorizationHeaderValue);
} else {
  invocationBuilder.header(authorizationHeaderName, authorizationHeaderValue);
}

I think this should be surrounded by another if:

if (!StringUtils.isEmpty(authorizationHeaderValue)) {

  if (!StringUtils.isEmpty(authorizationPrefix)) {
    invocationBuilder.header(
        authorizationHeaderName, authorizationPrefix + " " + authorizationHeaderValue);
  } else {
    invocationBuilder.header(authorizationHeaderName, authorizationHeaderValue);
  }

}

*WORK AROND:*Enter bogus values into the the to all there Authorization hear name fields.

TEST: You can use https://api.openligadb.de/getavailableleagues as Test URL (and `https://api.openligadb.de/' AS Base URL).

I can provide a PR if this is of any help but I am not sure if that is any faster.. :-)

Issue Priority

Priority: 3

Issue Component

Component: Metadata

@bamaer
Copy link
Contributor

bamaer commented Jan 7, 2025

.take-issue

@github-actions github-actions bot added this to the 2.12 milestone Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants