Open ostrolucky opened 4 years ago
Hi
The question is where the method normalization belongs. Should it be in the PSR-18 client or in the PSR-7 request or even in the PSR-17 factory
I think it would probably be best handled inside the client to handle PSR-7 implementations that don't have any validation on the method case.
I share same opinion. I don't think there currently exist PSR-17 factory or PSR-7 request with this normalization.
HTTP method names are case sensitive. Even though the standardized request methods are by convention uppercase, techically GET
, get
, gEt
and GeT
are all valid but also different request methods.
https://tools.ietf.org/html/rfc2616#section-5.1.1 https://tools.ietf.org/html/rfc7231#section-4
IMO libraries should not alter user provided request methods. Instead the user should provide the correct request method. In above case the stripe library should be fixed.
Why is Buzz doing normalization on some places, but not other places though?
I was experimenting with using this library as http client for stripe-php, via psr18-adapter/stripe-php that I'm working on now, but had to go back to Guzzle, as Buzz is broken there. You see, stripe library defines lowercased HTTP methods names everywhere, but their servers do not accept those:
I think you might want to make this library uppercase method names as well, like other libraries do. After all, you do that in some places already