Skip to content

Commit 49ab59b

Browse files
authoredMay 2, 2021
Update dependency-injection.md (#3630)
1 parent 3a0f369 commit 49ab59b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎website/src/docs/hotchocolate/api-reference/dependency-injection.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ public class CustomHttpRequestInterceptor : DefaultHttpRequestInterceptor
132132
2. Register `CustomHttpRequestInterceptor` with the root `ServiceCollection`.
133133

134134
```csharp
135-
services.AddHttpRequestInterceptor<CustomHttpRequestInterceptor>();
135+
services
136+
.AddGraphQLServer()
137+
.AddHttpRequestInterceptor<CustomHttpRequestInterceptor>();
136138
```
137139

138140
3. Next, inherit from `DefaultSocketSessionInterceptor` and override `OnRequestAsync`.
@@ -145,7 +147,7 @@ public class CustomSocketSessionInterceptor : DefaultSocketSessionInterceptor
145147
IQueryRequestBuilder requestBuilder,
146148
CancellationToken cancellationToken)
147149
{
148-
await await OnRequestAsync(connection, requestBuilder, cancellationToken);
150+
await OnRequestAsync(connection, requestBuilder, cancellationToken);
149151
requestBuilder.SetServices(CUSTOM_SERVICE_PROVIDER);
150152
}
151153
}
@@ -154,5 +156,7 @@ public class CustomSocketSessionInterceptor : DefaultSocketSessionInterceptor
154156
4. Last, register your `CustomSocketSessionInterceptor` with the root `ServiceCollection`.
155157

156158
```csharp
157-
services.AddSocketSessionInterceptor<CustomSocketSessionInterceptor>();
159+
services
160+
.AddGraphQLServer()
161+
.AddSocketSessionInterceptor<CustomSocketSessionInterceptor>();
158162
```

0 commit comments

Comments
 (0)
Please sign in to comment.