Created
December 21, 2016 09:25
-
-
Save JanneSalokoski/36e7d09212cfd916843ec8e224dc1d80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let express = require("express"); | |
let server = express() | |
let bodyParser = require('body-parser'); | |
let multer = require('multer'); // v1.0.5 | |
let upload = multer(); // for parsing multipart/form-data | |
// $npm install express body-parser multer --save | |
server.use(bodyParser.json()); // for parsing application/json | |
server.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded | |
server.post("/", function (req, res) | |
{ | |
console.log(req.body); | |
}); | |
server.listen(8080, function () | |
{ | |
console.log("Listening on http://localhost:8080/"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import json | |
URL = "http://localhost:8080/" | |
TIMES = 100 | |
HEADERS = {"Content-Type": "application/json"} | |
PAYLOAD = { | |
"messagetype": "GET_Shipments", | |
"data": | |
{ | |
"parameters": | |
[ | |
{ | |
"type": "string", | |
"customer": "5555" | |
}, | |
{ | |
"number": "764928" | |
} | |
], | |
"select": | |
[ | |
"idnum", | |
"nimi" | |
] | |
} | |
} | |
for i in range(0, TIMES): | |
r = requests.post(URL, data=json.dumps(PAYLOAD), headers=HEADERS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment