imbo / behat-api-extension

API extension for Behat, used to ease testing of JSON-based APIs
MIT License
109 stars 42 forks source link

Addresses issue #20, base_uri fix #21

Closed douglaslinsmeyer closed 7 years ago

douglaslinsmeyer commented 8 years ago

Addresses #20

christeredvartsen commented 8 years ago

Are you able to create some tests for this?

douglaslinsmeyer commented 8 years ago

Yeah, and it looks like I have to address something in the "withs" suite as well, I can't do that immediately but this evening I'll be able to.

christeredvartsen commented 8 years ago

This is a use case I have overlooked as I very rarely have paths like <host>/file.php/some/path in my own projects, but thanks a bunch for putting it out there. If you manage to add some test cases I'd love to pull it into the project.

douglaslinsmeyer commented 8 years ago

@christeredvartsen Have you already been notified that there are several tests that fail intermittently?

christeredvartsen commented 8 years ago

The tests fail because of absolute paths no longer work as expected.

If the base_uri includes a sub directory, for instance http://host/dir, and one is about to request /path, then the resulting path should be http://host/path and not http://host/dir/path. Have a look at the table in this section for examples:

http://docs.guzzlephp.org/en/latest/quickstart.html#making-a-request

In your specific use case, where the base_uri includes a script (http://host/script.php) there is actually no way to use an absolute path and have that appended to script.php using Guzzle.

christeredvartsen commented 8 years ago

@douglaslinsmeyer Do you have any feedback regarding my last comment? Please also check out my comment in the issue.

christeredvartsen commented 7 years ago

This goes against the usage that Guzzle has implemented (RFC 3986), so will not merge.