Advertisement
Guest User

Untitled

a guest
Oct 18th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. postStuff() {
  2. var body = "username=myusername&password=mypassword";
  3. var headers = new Headers();
  4. headers.append('Content-Type', 'application/x-www-form-urlencoded');
  5. return this.http.post('http://localhost:8000/rest/', body, { headers: headers })
  6. .map(res => res.json());
  7. }
  8.  
  9. curl -H 'Accept: application/json; indent=4' -u myusername:mypassword http://127.0.0.1:8000/rest/
  10.  
  11. return this.http.get('http://127.0.0.1:8000/users/')
  12. .map(res => res.json())
  13.  
  14. return this.http.post('http://127.0.0.1:8000/users/', { headers: headers })
  15. .map(res => res.json());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement