Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marinx/http-post-service
HTTP POST MESG Service in Go
https://github.com/marinx/http-post-service
golang mesg mesg-service
Last synced: 8 days ago
JSON representation
HTTP POST MESG Service in Go
- Host: GitHub
- URL: https://github.com/marinx/http-post-service
- Owner: MarinX
- License: mit
- Created: 2018-07-10T09:32:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-13T09:58:53.000Z (over 6 years ago)
- Last Synced: 2024-06-20T16:45:40.499Z (5 months ago)
- Topics: golang, mesg, mesg-service
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTP POST MESG service
Emits event on request and process POST calls
# Events
## onRequest
Event key: `onRequest`
Event emitted when server gets a HTTP POST request
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **body** | `String` | the body of the request |
| **date** | `String` | the date and time of the request |
| **id** | `String` | an unique id of the request |# Tasks
## batchExecute
Task key: `batchExecute`
Execute multiple HTTP POST calls
### Inputs
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **body** | `String` | the body of the request |
| **id** | `Number` | the ID of the request |
| **url** | `String` | the URL of the request |### Outputs
##### batchID
Output key: `batchID`
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **id** | `Number` | The ID of the request |##### error
Output key: `error`
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **message** | `String` | the error's message |##### success
Output key: `success`
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **body** | `String` | the body of the response |
| **statusCode** | `Number` | the status code of the response |## execute
Task key: `execute`
Execute HTTP POST call
### Inputs
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **body** | `String` | the body of the request |
| **url** | `String` | the URL of the request |### Outputs
##### error
Output key: `error`
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **message** | `String` | the error's message |##### success
Output key: `success`
| **Key** | **Type** | **Description** |
| --- | --- | --- |
| **body** | `String` | the body of the response |
| **statusCode** | `Number` | the status code of the response |# Testing
### with go test tool
`go test`
### with mesg test tool
Listen for event
`mesg-core service test --event-filter onRequest`
and execute to http://localhost:8080 POST RequestTest HTTP POST success
`mesg-core service test --task execute --data tests/service_post.json`
Test HTTP POST error
`mesg-core service test --task execute --data tests/service_should_fail.json`
Test batch HTTP Post
`mesg-core service test --task batchExecute --data tests/service_batch.json`
# License
This library is under the MIT License