guzzlebundleheaderforwardplugin's People
guzzlebundleheaderforwardplugin's Issues
Remove composer.lock
My suggestion is to remove composer.lock and add it to .gitignore. It's good practice and it will give you possibility to work always with latest versions of dependencies.
Possible issue in Middleware
Hello.
I think it's possible issue here: https://github.com/Neirda24/GuzzleBundleHeaderForwardPlugin/blob/master/src/GuzzleForwardHeaderMiddleware.php#L42
Why on line 53 you return $handler($request, $options);
but on line 42 you return $handler
? Why in first case handler doesn't receive request and options? Please test this case.
EightPointsGuzzleBundle 8 upgrade
It's released a month ago, so an upgrade would be nice.
I will do my best to create a good pull request.
Empty request stack forces an exception
If request stack is empty, the plugin throws an exception:
In GuzzleForwardHeaderMiddleware.php line 48:
[ErrorException]
Notice: Trying to get property 'headers' of non-object
This is because the plugin does not check if the current request is null:
src/GuzzleForwardHeaderMiddleware.php:
public function __invoke(callable $handler): callable
{
return function(RequestInterface $request, array $options) use (&$handler) {
if (empty($this->headers)) {
return $handler;
}
$currentRequest = $this->requestStack->getCurrentRequest(); // <<===
foreach ($this->headers as $header) {
if ($currentRequest->headers->has($header)) {
$request = $request->withHeader($header, $currentRequest->headers->get($header));
}
}
return $handler($request, $options);
};
}
/**
* @return Request|null
*/
public function getCurrentRequest() { … }
You'd better do this:
public function __invoke(callable $handler): callable
{
return function(RequestInterface $request, array $options) use (&$handler) {
if (empty($this->headers)) {
return $handler;
}
$currentRequest = $this->requestStack->getCurrentRequest(); // <<===
if (null !== $currentRequest) {
foreach ($this->headers as $header) {
if ($currentRequest->headers->has($header)) {
$request = $request->withHeader($header, $currentRequest->headers->get($header));
}
}
}
return $handler($request, $options);
};
}
How to reproduce:
Create a custom Symfony command, that triggers a Guzzle request, and fire the command from the console (no http request => no request stack).
Support PHP 8
Issue during instalation:
Package neirda24/guzzle-bundle-header-forward-plugin has requirements incompatible with your PHP version, PHP extensions and Composer version:
- neirda24/guzzle-bundle-header-forward-plugin 2.0.0 requires php ^7.0 which does not match your installed version 8.1.16.
Update for symfony 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.