您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cookie.js 510B

12345678910111213141516171819202122232425
  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. })