Comments (3)
We just encountered this today. Moved some services behind a proxy, so every service got to the same host with different base paths.
We thought this would only need some evn variable changes, but it can't be solved without changing code. In our case, a lot of it.
This should really be fixed.
from clients.
You are right, that is very confusing.
Looks like this is happening because of how options are passed into the various client methods. The client doesn't do the right thing and preserve any paths from the original url, rather it overrides it when you pass your request path into the http method based functions. See these lines for what's going on under the hood: https://github.com/restify/clients/blob/master/lib/HttpClient.js#L662-L664.
We should make this consistent and allow passing in of the prefix path or at least preserve the path from the original client creation.
In order to work around this for now you can do the following:
var client = restify.createJsonClient({
url: 'https://www.domain.com:4321/api'
});
client.post(client.url.path + '/service/path', { });
from clients.
I've made a wrapper over the clients (for another reason - I wanted a promise API), so I fixed it there.
I think I might be able to do a PR to fix this behavior.
from clients.
Related Issues (20)
- Request bodies ignored by restify clients on DELETE requests
- Help Wanted - FIPS: Is there a way to not add MD5 hash to header on post, this is needed for FIPS HOT 1
- HTTPClient: requestTimeout doesn't work on third and further requests HOT 1
- dtrace-provider dependency inadvertently removed by #101 HOT 1
- JsonClient not following redirects (301) HOT 1
- support content-md5 header generated from different node versions HOT 1
- Do not mix flowing and non-flowing mode for streams HOT 1
- `req.getMetrics` and `req.getTimings` undefined in error cases
- Babbling README
- Evaluate deprecated dependencies
- query string in client is missing when there is query string in request HOT 1
- Redirects don't work if going to another server
- Improvement: Add ability to do file uploads in requests
- OutgoingMessage.prototype._headers is deprecated
- Mutual Authentication
- Node.js v14 support
- Request callback not called in node 14
- Multipart form/data file upload won'twork with "Content Type" header on.
- AssertionError [ERR_ASSERTION]: req (object) is required HOT 1
- Upgrade uuid Dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clients.