Skip to content

Commit

Permalink
add yaml example
Browse files Browse the repository at this point in the history
  • Loading branch information
TheConcierge committed Jul 10, 2024
1 parent 8b528e4 commit c399af3
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions ngrok/examples/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ async fn start_tunnel() -> anyhow::Result<HttpTunnel> {

#[allow(dead_code)]
const POLICY_JSON: &str = r###"{
"Inbound":[
"inbound":[
{
"Name":"deny_put",
"Expressions":["req.Method == 'PUT'"],
"Actions":[{"Type":"deny"}]
"name":"deny_put",
"expressions":["req.Method == 'PUT'"],
"actions":[{"Type":"deny"}]
}],
"Outbound":[
"outbound":[
{
"Name":"test_out",
"Expressions":["res.StatusCode == '200'"],
"Actions":[{
"Type":"custom-response",
"Config":{
"name":"change success response",
"expressions":["res.StatusCode == '200'"],
"actions":[{
"type":"custom-response",
"config":{
"status_code":201,
"content": "Custom 200 response.",
"headers": {
Expand All @@ -104,3 +104,25 @@ const POLICY_JSON: &str = r###"{
}]
}]
}"###;

#[allow(dead_code)]
const POLICY_YAML: &str = r###"
---
inbound:
- name: "deny_put"
expressions:
- "req.Method == 'PUT'"
actions:
- type: "deny"
outbound:
- name: "change success response"
expressions:
- "res.StatusCode == '200'"
actions:
- type: "custom-response"
config:
status_code: 201
content: "Custom 200 response."
headers:
content_type: "text/html"
"###;

0 comments on commit c399af3

Please sign in to comment.