EYBlockchain / timber

Construct a Merkle Tree database from Ethereum logs.
Other
67 stars 19 forks source link

GET calls can have data as query params #29

Closed Westlad closed 3 years ago

Westlad commented 3 years ago

Timber expects GET requests, with accompanying data, to place that data in the request body. This is not really a supported http approach and some http clients will fail to package data in this way. This fix adds the option to pass data as GET query parameters. The code checks to see if the required data was passed in the body or as a query and thus is backwards compatible.

iAmMichaelConnor commented 3 years ago

Perhaps the 'API' section of the README could be updated to reflect this update? At the moment it specifies that GET requests should specify data in req.body.

iAmMichaelConnor commented 3 years ago

For completeness, I've checked the /merkleTree and /metadata routes and those GET requests already don't use req.body, which is good. Some of them use req.params instead of req.query, which could be unconventional, and which might need a separate Issue opening to address.

Westlad commented 3 years ago

For completeness, I've checked the /merkleTree and /metadata routes and those GET requests already don't use req.body, which is good. Some of them use req.params instead of req.query, which could be unconventional, and which might need a separate Issue opening to address.

req.params is when you are doing a GET to a restful endpoint like /getStockLevel/:sku It returns the value of 'sku' in this example.

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 3.0.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: