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

Respect uri parameter when using socketPath #252

Merged
merged 1 commit into from Sep 18, 2019

Conversation

@rs22
Copy link
Contributor

rs22 commented Jun 11, 2019

As stated in the README since version 15, 'when using socketPath the uri parameter to request and the shortcut functions will be ignored'.

This means that one can no longer request anything but '/' from an HTTP server that is listening on a Unix socket. Could you comment on why this change was made?

My proposal to restore the functionality from wreck v14 is to use the URL constructor with a pseudo-base url and to only use those of the resulting options that were previously also set by url.parse().

Usage example (essentially same as with v14):

const Wreck = require('@hapi/wreck');

const makeRequest = async () => {

    const docker = Wreck.defaults({ socketPath: '/var/run/docker.sock' });
    const { payload } = await docker.get('/v1.37/containers/json', { json: true });
    console.log(payload);
};

makeRequest();
@hueniverse

This comment has been minimized.

Copy link
Member

hueniverse commented Sep 18, 2019

Seems fine to me.

@geek see any reason why we can't restore this functionality? I wasn't the one who made the change breaking it...

@hueniverse hueniverse self-assigned this Sep 18, 2019
@geek

This comment has been minimized.

Copy link
Member

geek commented Sep 18, 2019

@rs22 looks good. I added a test case rs22#1 for the defaults example

@geek
geek approved these changes Sep 18, 2019
@hueniverse hueniverse merged commit 637cb26 into hapijs:master Sep 18, 2019
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
hueniverse added a commit that referenced this pull request Sep 18, 2019
@hueniverse hueniverse added the feature label Sep 18, 2019
@hueniverse hueniverse added this to the 15.0.3 milestone Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.