Git Product home page Git Product logo

Comments (3)

abustya avatar abustya commented on May 22, 2024 1

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.

micahr avatar micahr commented on May 22, 2024

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.

bruno-brant avatar bruno-brant commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.