From b93d36fcb2ca3d638f17b0be6054315266bfcf85 Mon Sep 17 00:00:00 2001 From: Fabian Eichhorner Date: Wed, 12 Dec 2018 23:22:15 +0100 Subject: [PATCH] Added curl to service-reporting --- service-reporting/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/service-reporting/README.md b/service-reporting/README.md index 49640ff..527651f 100644 --- a/service-reporting/README.md +++ b/service-reporting/README.md @@ -41,4 +41,10 @@ Term(string `Name`, double `Sentiment`) - .net core 2.2 - download [libwkhtml library](https://github.com/rdvojmoc/DinkToPdf/tree/master/v0.12.4) depending on your operating system and put it into `service-reporting` root folder ### commands -- `dotnet run` \ No newline at end of file +- `dotnet run` + +## Tests +- successfull pdf as application/json: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] '` +- successfull pdf as application/base64: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Accept: application/base64' \ -H 'Content-Type: application/json' \ -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] '` +- invalid sentiment value: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name": "Term with invalid sentiment value", "sentiment": 12 } ] '` +- invalid json structure: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name1": "A term with invalid json format", "sentiment": 0.5 } ] '` \ No newline at end of file -- 2.43.0