Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Last active August 29, 2015 14:10
Show Gist options
  • Save ashleygwilliams/f592f2b6970a7109d2f1 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/f592f2b6970a7109d2f1 to your computer and use it in GitHub Desktop.
testing POST on piep
LIST POST
curl -H "Content-Type: application/json" -d '{"curator":"Ashley","curator_org":null,"collaborators":null,"name":"POST request TEST","description":"DO YOU EVEN POST BRO","version":"0.0.0","license":"MIT","keywords":null}' http://localhost:8080/api/0/lists
RESOURCE POST
curl -H "Content-Type: application/json" -d '{"author":"Ashley","author_org":null,"title":"POST?","description":"testtesttest","github_url":"https://github.com/tbranyen/angular-directive.git","keywords":null,"version":"5.0.0","license":"MIT"}' http://localhost:8080/api/0/resources
app.post('/test', function(req, res){
console.log("REQUEST HEADERS: ", req.headers);
console.log("REQUEST BODY: ", req.body);
res.send("CZECH YO CONSOLE");
});
app.get('/test', function(req, res){
console.log("REQUEST HEADERS: ", req.headers);
console.log("REQUEST BODY: ", req.body);
res.send("CZECH YO CONSOLE");
});
REQEST
curl -H "Content-Type: application/json" -d '{
"author": "james",
"content": "test",
"version": "1.0.0"
}' http://localhost:8080/test
RESPONSE
REQUEST HEADERS: { 'user-agent': 'curl/7.30.0',
host: 'localhost:8080',
accept: '*/*',
'content-type': 'application/json',
'content-length': '70' }
REQUEST BODY: undefined
REQUEST
curl --data "author=ashley&content=TEST&version=1" http://localhost:8080/test
RESPONSE
REQUEST HEADERS: { 'user-agent': 'curl/7.30.0',
host: 'localhost:8080',
accept: '*/*',
'content-length': '36',
'content-type': 'application/x-www-form-urlencoded' }
REQUEST BODY: undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment