Advertisement
Guest User

Untitled

a guest
May 26th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. var fs = require("fs");
  2. var request = require("request");
  3.  
  4. var options = { method: 'POST',
  5. url: 'http://localhost:8000/admin/package/',
  6. headers:
  7. { 'cache-control': 'no-cache',
  8. Connection: 'keep-alive',
  9. 'content-length': '108246',
  10. 'accept-encoding': 'gzip, deflate',
  11. Host: 'localhost:8000',
  12. 'Postman-Token': '268879bd-0af7-4199-a9a6-63b14b9728d8,52a3a691-42c3-4e33-aa8a-01281f74b0d2',
  13. 'Cache-Control': 'no-cache',
  14. Accept: '*/*',
  15. 'User-Agent': 'PostmanRuntime/7.13.0',
  16. 'Content-Type': 'application/x-www-form-urlencoded',
  17. 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' },
  18. formData:
  19. { description: 'package form data',
  20. title: 'test package form data',
  21. community: 'hihi',
  22. color_scheme: '#hahaha17',
  23. questions: '[{\n "answer": [\n "true"\n ],\n "options": [\n "string"\n ],\n "question": "string",\n "type": "string"\n }\n ]',
  24. image_background:
  25. { value: 'fs.createReadStream("/Users/haithanh079/Downloads/60548353_328063354545788_1343610377442689024_n.jpg")',
  26. options:
  27. { filename: '/Users/haithanh079/Downloads/60548353_328063354545788_1343610377442689024_n.jpg',
  28. contentType: null } } } };
  29.  
  30. request(options, function (error, response, body) {
  31. if (error) throw new Error(error);
  32.  
  33. console.log(body);
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement