Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Strings not sending? #3

Closed
kubacode opened this issue Jul 5, 2015 · 4 comments
Closed

Query Strings not sending? #3

kubacode opened this issue Jul 5, 2015 · 4 comments

Comments

@kubacode
Copy link
Contributor

kubacode commented Jul 5, 2015

@kz are the Query Strings for setLights, setColor, breatheLights & pulseLights methods sending the query string correctly for you? I've had to refactor the sendRequest method to accept an additional parameter with the query string, rather than the third parameter in a new Request.

I may have a different version of Guzzle installed compared to the version used to develop, so this could be the case of the issue - I'm currently running 6.0.1.

I'll pop through a PR with a fix if they aren't set correctly!

@kz
Copy link
Owner

kz commented Jul 5, 2015

Hi @kubacode, thanks for opening the issue. I have not had the time to actually test the code yet and I'm busy with another project right now which I need to finish before working on this.

The issue may come from the fourth parameter in new Request:

$request = new Request('PUT', 'lights/' . $selector . '/power', [], [
    'state' => $state,
    'duration' => $duration,
]);

As you can see, an associative array is being uploaded. However, Guzzle's documentation shows:

$response = $client->post('http://httpbin.org/post', [
    'form_params' => [
        'field_name' => 'abc',
        'other_field' => '123',
        'nested_field' => [
            'nested' => 'hello'
        ]
    ]
]);

Therefore, it might fix it should you pass the associative array as a value for the key 'form_params' as shown above. This might work, although I am unsure, as this comes for the documentation for the Client class instead of the Request class.

I won't be able to work on this anytime soon since I really want to make progress with Panel for LIFX (mainly to learn AngularJS by the end of this week). I appreciate the time you have invested in this package and my lack of maintenance of this package will be over soon!

@kubacode
Copy link
Contributor Author

kubacode commented Jul 6, 2015

I've got a fix for this already - I'll pop through a PR after work this evening.

No problem at all with lack of maintenance - good luck with Panel for LIFX!

@kubacode
Copy link
Contributor Author

kubacode commented Jul 6, 2015

PR submitted!

@kz
Copy link
Owner

kz commented Jul 6, 2015

Thank you!

@kz kz closed this as completed Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants