Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-6725

Serverless workflow unable to retriev openapi due to invalid Accept headers

XMLWordPrintable

    • False
    • False
    • 2022 Week 05-07 (from Jan 31)

      When using a url in my sw.yaml, ie https://my.remote.host/apicatalog/runtimes/ibm/apis/\{apiID}/document#myOperation  the `mvn clean package quarkus:dev` command fails with a 400 error.

      {{[ERROR] Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://my.remote.host/apicatalog/runtimes/ibm/apis/bd7cd1b8-c894-4a05-a791-5e34f443e93a?platformnamespace=laworkflow&fields=api
      [ERROR] at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1924)
      [ERROR] at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
      [ERROR] at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
      [ERROR] at java.base/java.net.URL.openStream(URL.java:1165)
      [ERROR] at org.kie.kogito.codegen.openapi.client.io.HTTPResolver.resolve(HTTPResolver.java:42)
      [ERROR] ... 27 more}}
      Having looked at the code that is being called when it is connecting to the URL: https://github.com/kiegroup/kogito-runtimes/blob/44867f27af0337a00de018e4c5ef8d1f71dd26e9/kogito-codegen-modules/kogito-codegen-openapi/src/main/java/org/kie/kogito/codegen/openapi/client/io/HTTPResolver.java#L38 and generating a test java app that does the same calls I can see that the openStream is failing and the connection is returning this:

      {{

      {"status":400,"message":["The value of the Accept header 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2' is not supported for the operation (supported values: application/json, application/yaml)"]}

      }}
      If I add an Accept: application/yaml header to my connection request in my test java the connect works. I then get an Unauthorised but that is as expected as I haven't passed the auth info to my test application.

      Is there any way we can specify a different Accept header, or is this a bug and it should work without having to pass an Accept header?

              rhn-support-zanini Ricardo Zanini
              groeges Steven Groeger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: