JetBrains / JetBrains/http-request-in-editor-spec
Access the METHOD and http Path of the http call in pre-request scripts
- Dominant language
- No language data
- Stars
- 152
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Hi! Love this!
I have been porting over some postman collections to http client calls, but I'm missing a bit of functionality. Some of the HMAC signature generating things I've used have needed to get the HTTP method and path from the client call.
Right now the only way I could figure out how to do this is to just type it in the signature bit:
```javascript
const endpoint = "/v1/customer/search?alias=eml"
request.variables.set("endpoint", endpoint)
const payload = request.body.tryGetSubstituted().replace(/\s/g,'')
const signature_content = "POST" +
request.headers.findByName("X-APP-API_TIMESTAMP").tryGetSubstitutedValue() +
request.environment.get("api_key") +
endpoint +
request.headers.findByName("correlation-id").tryGetSubstitutedValue() +
payload
```
What I'd like to do:
```javascript
const payload = request.body.tryGetSubstituted().replace(/\s/g,'')
const signature_content = request.method + //Would give back the http method typed in
request.headers.findByName("X-APP-API_TIMESTAMP").tryGetSubstitutedValue() +
request.environment.get("api_key") +
request.url.path + // would include the query string so like /v1/customer/search?alias=eml (or whatever they typed in excluding the host)
request.headers.findByName("correlation-id").tryGetSubstitutedValue() +
payload
```
Having this would make a generic HMAC library that we could share super easy!
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.