Skip to content

Commit

Permalink
Update interceptor section
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK authored Jan 22, 2024
1 parent 69f895f commit 3cec446
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions docs/spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@ service class RequestInterceptor {
resource function 'default [string… path](http:RequestContext ctx, http:Request req) returns http:NextService|error? {
req.setHeader("X-requestHeader", "RequestInterceptor");
ctx.next();
return ctx.next();
}
}
```
Expand All @@ -2108,7 +2108,7 @@ service class RequestInterceptor {
resource function 'default foo(http:RequestContext ctx, http:Request req) returns http:NextService|error? {
req.setHeader("X-requestHeader", "RequestInterceptor");
ctx.next();
return ctx.next();
}
}
```
Expand Down Expand Up @@ -2211,7 +2211,7 @@ service class ResponseInterceptor {
remote function interceptResponse(http:RequestContext ctx, http:Response res) returns http:NextService|error? {
res.setHeader("X-responseHeader", "ResponseInterceptor");
ctx.next();
return ctx.next();
}
}
```
Expand Down Expand Up @@ -2318,13 +2318,6 @@ However, if the user decides to respond at 4 and terminate the cycle, only the `
Also, when the `RequestInterceptor` at 2 returns an error, the execution jumps from 2 to 6 as the nearest Error Interceptor
is at 6. The same goes to the response path.

The execution order when interceptors are engaged at both service and listener levels is as follows:

```
ListenerLevel : RequestInterceptors -> ServiceLevel : RequestInterceptors -> TargetService ->
ServiceLevel : ResponseInterceptors -> ListenerLevel : ResponseInterceptors
```

Execution of interceptors does not depend on the existence of the end service i.e. the interceptors are executed in the
relevant order even though the end service does not exist.

Expand Down

0 comments on commit 3cec446

Please sign in to comment.