You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
510 B

4 years ago
  1. var Buffer = require('buffer').Buffer
  2. var test = require('tape')
  3. var http = require('../..')
  4. test('cookie', function (t) {
  5. var cookie = 'hello=world'
  6. window.document.cookie = cookie
  7. http.get({
  8. path: '/cookie',
  9. withCredentials: false
  10. }, function (res) {
  11. var buffers = []
  12. res.on('end', function () {
  13. t.ok(new Buffer(cookie).equals(Buffer.concat(buffers)), 'hello cookie echoed')
  14. t.end()
  15. })
  16. res.on('data', function (data) {
  17. buffers.push(data)
  18. })
  19. })
  20. })