-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(scripts): add request.body.getComputed()
#262
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Returns the `string` request body as sent via curl; with variables substituted, or `undefined` if there is no body. Very useful if you want to see the request body as it was sent to the server. The `tryGetSubstituted` method will substitute variables with their values, but leave the rest of the body as is. If you have a GraphQL query in the body, for example, the `getComputed` method will show the query as it was sent to the server, which is quite different from the substituted version. As an example, if you have a request body like this: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "{{ENV_VAR_CLIENT_NAME}}" } } ``` Then the `getComputed` method will return the body as it was sent to the server: ```json {"query": "query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } ", "variables": {"variables": {"name": "kulala"}}} ``` whereas the `tryGetSubstituted` method will return the body with variables substituted as seen in your script: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "kulala" } } ``` The `getComputed` method is always `undefined` for binary bodies.
gorillamoe
force-pushed
the
feat/scripts-get-computed-body
branch
from
October 6, 2024 11:35
401086d
to
08ce122
Compare
X-Ref: #194 |
gorillamoe
added a commit
to rcasia/kulala.nvim
that referenced
this pull request
Oct 7, 2024
Returns the `string` request body as sent via curl; with variables substituted, or `undefined` if there is no body. Very useful if you want to see the request body as it was sent to the server. The `tryGetSubstituted` method will substitute variables with their values, but leave the rest of the body as is. If you have a GraphQL query in the body, for example, the `getComputed` method will show the query as it was sent to the server, which is quite different from the substituted version. As an example, if you have a request body like this: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "{{ENV_VAR_CLIENT_NAME}}" } } ``` Then the `getComputed` method will return the body as it was sent to the server: ```json {"query": "query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } ", "variables": {"variables": {"name": "kulala"}}} ``` whereas the `tryGetSubstituted` method will return the body with variables substituted as seen in your script: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "kulala" } } ``` The `getComputed` method is always `undefined` for binary bodies.
iamxiaojianzheng
pushed a commit
to iamxiaojianzheng/kulala.nvim
that referenced
this pull request
Oct 24, 2024
Returns the `string` request body as sent via curl; with variables substituted, or `undefined` if there is no body. Very useful if you want to see the request body as it was sent to the server. The `tryGetSubstituted` method will substitute variables with their values, but leave the rest of the body as is. If you have a GraphQL query in the body, for example, the `getComputed` method will show the query as it was sent to the server, which is quite different from the substituted version. As an example, if you have a request body like this: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "{{ENV_VAR_CLIENT_NAME}}" } } ``` Then the `getComputed` method will return the body as it was sent to the server: ```json {"query": "query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } ", "variables": {"variables": {"name": "kulala"}}} ``` whereas the `tryGetSubstituted` method will return the body with variables substituted as seen in your script: ```graphql query getRestClient($name: String!) { restclient(name: $name) { id name editorsSupported { name } } } { "variables": { "name": "kulala" } } ``` The `getComputed` method is always `undefined` for binary bodies.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Returns the
string
request body as sent via curl; with variables substituted, orundefined
if there is no body.Very useful if you want to see the request body as it was sent to the server.
The
tryGetSubstituted
method will substitute variables with their values, but leave the rest of the body as is.If you have a GraphQL query in the body, for example, the
getComputed
method will show the query as it was sent to the server, which is quite different from the substituted version.As an example, if you have a request body like this:
Then the
getComputed
method willreturn the body as it was sent to the server:
whereas the
tryGetSubstituted
method willreturn the body with variables substituted as seen in your script:
The
getComputed
method is alwaysundefined
for binary bodies.