Skip to content

Client instantiation loses (default) config optionsΒ #11

@otsch

Description

@otsch

PHP version: 8.0.14

Description
When using the Client it happened that I got a 301 redirect response. So not the response from the uri where it redirected to but an actual response object with status code 301. The guzzle default should be to allow and automatically follow redirects and it also did then when I tried with guzzle directly.

I then also tried the createWithConfig() static method of the Client and explicitly gave it the config (allow_redirects as in the docs), but with the same outcome.

How to reproduce
Make a Client and request a uri that redirects to somewhere else.

Possible Solution
The private static buildClient() method creates a handler stack and passes it along with the config over to the new guzzle client. When the guzzle client doesn't get a handler stack it creates one by calling HandlerStack::create(). I think the buildClient() method should either use this method or even better, just don't create a handler stack itself but just leave this to guzzle itself?

I'll prepare a PR for this.

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