Giter Site home page Giter Site logo

Comments (4)

indexzero avatar indexzero commented on July 1, 2024

@CthulhuL So you are using res.redirect() eh? I think this is a problem around how api-easy wraps request.

From the request README:

  • followRedirect - follow HTTP 3xx responses as redirects. defaults to true.

So by default request is following the redirect and attempting your POST again. I will take a look at the code and see what I can do to expose disabling this.

from api-easy.

indexzero avatar indexzero commented on July 1, 2024

@CthulhuL I have fixed this in v0.2.2 which is now published to npm. Your updated test should look like this:

suite
    .use('localhost', 3000)
    .setHeader('Content-Type', 'application/json')
    .followRedirect(false)
    .discuss('When using the Thread API')
        .post('/thread', {title: 'title-test', author: 'John Doe'})
            .expect(302)
            .next()

Notice the additional .followRedirect(false) which sets { followRedirect: false } in the underlying options which are passed to request.

from api-easy.

fwielstra avatar fwielstra commented on July 1, 2024

Excellent, works like a charm - thanks for the fix!

from api-easy.

kareblak avatar kareblak commented on July 1, 2024

Would be nice if there was some way of being redirected on command, after next(), so a verification on the redirection it self could be made.

from api-easy.

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.