Skip to content

Using multiple interceptors only produces the output from the last interceptor. #363

Closed
@haroon-sheikh

Description

@haroon-sheikh

Describe the bug
When using configuring multiple interceptors, only the last one in the config produces output.

To Reproduce

  1. Configure two interceptors
Unirest.config()
        .interceptor(new Interceptor() {
            @Override
            public void onRequest(HttpRequest<?> request, Config config) {
                System.out.println("Output from first interceptor");
            }
        }).interceptor(new Interceptor() {
    @Override
    public void onRequest(HttpRequest<?> request, Config config) {
        System.out.println("Output from Second interceptor");
    }
});
Unirest.get("https://reqres.in/api/users?page=2").asJson();

Expected behavior
Outcome from both interceptors

Output from first interceptor
Output from Second interceptor

but we only see the output from the 2nd interceptor.

Output from Second interceptor

Screenshots
If applicable, add screenshots to help explain your problem.

Environmental Data:

  • Java Version - 11
  • Version [e.g. 3.8.06]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions