Skip to content
New issue

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

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

Already on GitHub? # to your account

No route was found matching the URL and request method #17

Closed
angelxmoreno opened this issue Jun 11, 2023 · 1 comment · Fixed by #18
Closed

No route was found matching the URL and request method #17

angelxmoreno opened this issue Jun 11, 2023 · 1 comment · Fixed by #18
Labels
bug Something isn't working

Comments

@angelxmoreno
Copy link
Owner

object(GuzzleHttp\Exception\ClientException) id:0 {
protected message => 'Client error: `GET https://angelm106.sg-host.com/wp-json/wp/v2/postsper_page=10` resulted in a `404 Not Found` response:
{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}
'
protected code => (int) 404
protected file => '/Users/amoreno/Projects/MetaSuggestionsApi/meta-suggestions-api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php'
protected line => (int) 113
}
@angelxmoreno angelxmoreno added the bug Something isn't working label Jun 11, 2023
@angelxmoreno
Copy link
Owner Author

https://github.com/angelxmoreno/WPRestClient/blob/main/src/Core/ApiClient.php#L80

$url .= http_build_query($data);

should be

$url .= '?' . http_build_query($data);

This bug begs the question: "How was this not caught by the unit tests?"

The answer is that the HTTPClient is stubbed. Perhaps verifying the data received by the stub would have caught this.

angelxmoreno added a commit that referenced this issue Jun 11, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant