Skip to content

Http Binding returning wrong status code #1127

Closed
@rochabr

Description

@rochabr

Actual Behavior

Upgrading the Java Dapr SDK from 1.11 to 1.12 changed the exception handling behaviour in Http Binding where the errorIfNot2XX flag is set to false.

ie: When service A calls service B and B throws an error:

Dapr SDK 1.11
A gets the error status code (eg 400) and the error response body.

image

Dapr SDK 1.12
A gets the status code (eg 405) as part of the response body itself and overall http request status is 200.

image

They are mentioning that they now need to parse the response body manually in order to evaluate whether the call fetched a successful response or an exception.
Here is the code:

Map<String, String> requestMetaData = new HashMap<>();
requestMetaData.put("errorIfNot2XX", "false");

daprClient.invokeBinding(
        "fetch-documents-using-group-name",
        DaprHttpMethod.POST,
        body,
        requestMetaData,
        Void.class);
mono.block();

Is this a bug or was this change planned? This is likely due to the way the change in the java sdk returning status object and not httpStatusCode .

Metadata

Metadata

Assignees

Labels

P0kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions