Giter Site home page Giter Site logo

Comments (8)

richzw avatar richzw commented on August 20, 2024

also if I set .followRedirect(true), I can not get the 200, which mean API-easy can not support it now?

from api-easy.

cronopio avatar cronopio commented on August 20, 2024

I guess the quick an easy solution is have a variable and store there the url.

var urlRedir;
suite.discuss('now we create a project')
.use('localhost', 3000)
.setHeader('Content-Type', 'application/json')
.followRedirect(false)
.path('/projects')
.post( { information : 'good news'})
.expect(302)
.expect('redirect content', function(err, res, body){
  urlRedir = res.headers.location;
})
.get(urlRedir)

I dont know if suit for you

from api-easy.

richzw avatar richzw commented on August 20, 2024

hi Daniel,

I try your code, but the urlRedir in get() method is undefined.

then I add .next() before .get(urlRedir), however, it does Not work.

any idea for that?

from api-easy.

tomekc avatar tomekc commented on August 20, 2024

I have the same problem, I'd like to save some value returned by one query and use it in next query (as a parameter, for example). I came up @cronopio suggestion on my own, but it is not working (variable is undefined).

from api-easy.

cronopio avatar cronopio commented on August 20, 2024

I dont what can be. I have a couple of projects doing that and work. Can you share some gist with the code you have?

from api-easy.

richzw avatar richzw commented on August 20, 2024

Thanks @cronopio
I find it can work well with this code

.followRedirect(false)
.path('/projects')
.post({project: { name : 'hf1sp3'

However, I use the following code before and the urlRedir is undefined

.followRedirect(false)
.post('/projects', {project: { name : 'hf1sp3'

I think the two codes are same, but it is not.
why?

from api-easy.

richzw avatar richzw commented on August 20, 2024

@cronopio

I am sorry that I have made some mistakes. the urlRedir is undefined. Both post and get use the same url /projects

For details, please refer to https://gist.github.com/3156327

from api-easy.

ajostergaard avatar ajostergaard commented on August 20, 2024

Switching back to pure vows due to this 'undefined' issue. :-|

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.