forked from membrane/api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapis.yaml
More file actions
41 lines (39 loc) · 1.5 KB
/
apis.yaml
File metadata and controls
41 lines (39 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# yaml-language-server: $schema=https://www.membrane-api.io/v7.1.2.json
api:
port: 9998
flow:
# Membrane does not support WebSocket Extensions for now, so we remove the header
- groovy:
src: |
if(exc.getRequest() != null)
exc.getRequest().getHeader().removeFields("Sec-WebSocket-Extensions");
if(exc.getResponse() != null)
exc.getResponse().getHeader().removeFields("Sec-WebSocket-Extensions");
# WebSocket intercepting starts here
- webSocket:
url: http://localhost:61614/
flow:
# the wsStompReassembler take a STOMP over WebSocket frame and constructs an exchange from it
- wsStompReassembler:
flow:
# modify the exchange to have a "[MEMBRANE]:" prefix
- groovy:
src: |
def method = exc.getRequest().getMethod();
def header = exc.getRequest().getHeader();
def body = exc.getRequest().getBodyAsStringDecoded();
if(exc.getRequest().getMethod() == "SEND")
body = "[MEMBRANE]: " + exc.getRequest().getBodyAsStringDecoded();
exc.setRequest(new Request.Builder().method(method).header(header).body(body).build());
# logs the content of a WebSocket frame to the console
- wsLog: {}
target:
host: localhost
port: 9999
---
api:
port: 9999
flow:
- webServer:
docBase: .
index: index.html