HTTP Client which uses OpenAPI calls to communicate with an HTTP server, written in Go
Things I've learned from the project:
- HTTP network protocol, GET, POST
- JWAuth Bearer Token auth with HTTP POST is possible by addig a header to do that, aka. we send the token with each POST request
- HTTP Headers specify what information we are sending or expect to receive from server, we call them media types such as: application/json, application/pdf
- Marshal from Go data to multipart/form-data
- Marshal from Go data to JSON, unmarshaling JSON to Go
- Set baseUrl to localhost addr
- Even when the program crashes the requests till that point can be examined
- Important: Only HTTP works! HTTPS doesn't work
Terminal #0
nc -l -p 1234 -v | less -> nc/netcat [TCP/IP server testing tool], -l [listens on the port], -p [sets port], -v [return more info]
Terminal #1
curl http://127.0.0.1:1234/ -> make HTTP GET request to test
- If the API documentation includes example on the Curl on succesful api call in the correct format
- We can check against the curl ran locally as the example shows:
- This way essentially we are comparing the packet sent and the packet succesfully received by the server
