supertest icon indicating copy to clipboard operation
supertest copied to clipboard

Passing a url

Open Philmod opened this issue 14 years ago • 3 comments

Hi!

When I want to pass a url instead of a server, I do:

var request = require('supertest')
  , request = request.bind(request, 'http://localhost:3000')
  ;

In the tests:

request
  .post('/smth...')
  .expect(200)
  .end(function(err,res) {...});

But I get the error:

TypeError: Object function() { [native code] } has no method 'post'

Can you please tell me what I'm doing bad?

Best, Philmod

node v0.8.12 supertest v0.4.0

Philmod avatar Oct 31 '12 17:10 Philmod

Any advice please?

Philmod avatar Nov 21 '12 09:11 Philmod

@Philmod Following the example in the README didn't work for me either, just pass a string as the the app, like in this test case.

https://github.com/visionmedia/supertest/blob/master/test/supertest.js#L43

shanestillwell avatar Dec 27 '12 18:12 shanestillwell

sorry about that, bad docs, fixed

tj avatar Dec 28 '12 19:12 tj