GithubHelp home page GithubHelp logo

Comments (7)

bagwaa avatar bagwaa commented on August 18, 2024

After some investigation.

/src/Adapter/Guzzle/GuzzleAdapter.php

the convertRequest(Request $request) method casts the Symfony request into a string, and then passes this on to the MessageFactory class, this casting seems to lose everything in the request property in the Symfony request.

Once this is confirmed as a bug and not just me holding it wrong which is entirely possible, I will make a PR over the next few days.

from php-proxy.

jenssegers avatar jenssegers commented on August 18, 2024

It looks like a bug, but I don't understand why it would lose the changes when casting to a string.

from php-proxy.

jenssegers avatar jenssegers commented on August 18, 2024

I did some tests, but for me it was working okay. I added an Authorization header to the request and it was passed to Guzzle.

I did some small changes to the filter system. You can now also pass anonymous functions as filters.

Let me know if the last version also fixed your problem.

from php-proxy.

bagwaa avatar bagwaa commented on August 18, 2024

Yeah passing in headers was always fine, it was just when passing in more items onto the request.

$request->request->add(['bar' => 'baz']);

I can have a look later. I did also see some weirdness with applyRequestFilter and assigning that back, I see you have fixed that, thanks :)

Rich

from php-proxy.

jenssegers avatar jenssegers commented on August 18, 2024

Is the original issue fixed as well?

from php-proxy.

bagwaa avatar bagwaa commented on August 18, 2024

The original issue of trying to add items to the request (not the header, the actual request) still exists, I am a bit confused at the moment as to why a casting to a string loses information when it is listed perfectly fine pre-casting.

maybe I can put together some class to handle this conversion, either to string or directly to some JSON object, very strange one for sure.

/**
 * Convert the Symfony request to a Guzzle request.
 *
 * @param  Request $request
 * @return RequestInterface
 */
protected function convertRequest(Request $request)
{
    return $this->messageFactory->fromMessage((string) $request);
}

from php-proxy.

bagwaa avatar bagwaa commented on August 18, 2024

Further investigation, I think this is down to how the Symfony Request object is handling the casting via the toString() method in Request, this method in turn calls getContent() which then references php://input to get the contents once, not 100% sure yet, but I have a feeling this is where things are going a bit wonky, will keep playing around.

from php-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.