-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support of response status_code in rhai (#5045)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Co-authored-by: Jesse Rosenberger <git@jro.cc> Co-authored-by: Gary Pennington <gary@apollographql.com>
- Loading branch information
1 parent
f24ae3a
commit 3aa271d
Showing
5 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
### Add support for response status_code to rhai ([Issue #5042](https://github.com/apollographql/router/issues/5042)) | ||
|
||
Added support for `response.status_code` on `Response` interface in rhai. | ||
|
||
Convert response status code to a string. | ||
|
||
```rhai | ||
if response.status_code.to_string() == "200" { | ||
print(`ok`); | ||
} | ||
``` | ||
|
||
Also useful if you want to convert response status code to a number | ||
|
||
```rhai | ||
if parse_int(response.status_code.to_string()) == 200 { | ||
print(`ok`); | ||
} | ||
``` | ||
|
||
By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/5045 |
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
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
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
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