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

Base URL message factory #39

Closed
jakzal opened this issue Mar 15, 2016 · 4 comments
Closed

Base URL message factory #39

jakzal opened this issue Mar 15, 2016 · 4 comments

Comments

@jakzal
Copy link

jakzal commented Mar 15, 2016

Having to prefix all the calls with a base URL is annoying:

$factory->createRequest('GET', 'http://example.com/foo');

It could be avoided if we implemented something like the following that would include the base url for us:

$factory = new BaseUrlMessageFactory('http://example.com', new GuzzleMessageFactory());
$request = $factory->createRequest('GET', '/foo');

The advantage is that we wouldn't need to deal with base url in the place where the factory is used.

What do you think?

@xabbuh
Copy link
Member

xabbuh commented Mar 15, 2016

It looks like the AddHostPlugin does this job (it doesn't seem to have documentation right yet).

@jakzal
Copy link
Author

jakzal commented Mar 15, 2016

Moreless ;) cheers!

@jakzal jakzal closed this as completed Mar 15, 2016
@sagikazarmark
Copy link
Member

Be aware of the way how PSR-7 describes URI trailing slashes a bit illogical IMO. See php-http/plugins#42 (comment)

@jakzal
Copy link
Author

jakzal commented Mar 16, 2016

Actually, i'd love to be able to pass a string there :/

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

3 participants