Skip to content

Commit b9a3225

Browse files
author
warreee
authored
Merge branch 'dev' into patch-1
2 parents c4e43a8 + 704d5e3 commit b9a3225

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

docs/CustomMiddlewareChain.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,40 @@ export class MyLoggingHandler implements Middleware {
144144
}
145145
```
146146
Refer [MiddlewareOptions](../src/middleware/options/IMiddlewareOptions.ts) interface to know its structure.
147+
148+
### Modifying the Current Middleware Chain
149+
150+
```js
151+
// initialising client
152+
const client = MicrosoftGraph.Client.init({
153+
defaultVersion: "v1.0",
154+
debugLogging: true,
155+
authProvider: (done) => {
156+
done(null, secrets.accessToken);
157+
},
158+
});
159+
160+
// getting the current middleware chain (in this case, it's the default one)
161+
let arr = client.getMiddlewareChain();
162+
163+
// Initialising the Middleware chain that we created
164+
const dummyRandomHandler = new dummyRandomHandler();
165+
166+
// adding the dummy handler in the array of middlewares at 3rd position
167+
arr.splice(2, 0, dummyRandomHandler);
168+
169+
// setting the new middleware chain
170+
client.setMiddlewareChain(arr);
171+
172+
// calling the api
173+
client
174+
.api("/me")
175+
.select("displayName")
176+
.get()
177+
.then((res) => {
178+
console.log(res);
179+
})
180+
.catch((err) => {
181+
console.log(err);
182+
});
183+
```

docs/GettingRawResponse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Steps for getting the raw response [i.e [Response Object](https://developer.mozi
44

55
## Initialize the Client
66

7-
Refer [this documentation](../CreatingClientInstance.md) for initializing the client.
7+
Refer [this documentation](./CreatingClientInstance.md) for initializing the client.
88

99
## Getting Raw Response by setting ResponseType
1010

0 commit comments

Comments
 (0)