Skip to content

Get the GetService into HttpContextWrapper #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 15, 2023

Conversation

birojnayak
Copy link
Contributor

Porting GetService to HttpContextWrapper . This will fix the issue #456


public override object GetService(Type serviceType)
{
return ((HttpContextCore)_context).RequestServices.GetService(serviceType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should delegate to the _context.GetService method. The HttpContext.GetService() method could hook into the _context.RequestServices

@birojnayak birojnayak force-pushed the HttpContextWrapperFix branch from de5ee2d to 6f5b309 Compare December 8, 2023 21:08
@@ -81,5 +81,10 @@ public override IPrincipal User
public override void RewritePath(string filePath, string pathInfo, string? queryString, bool setClientFilePath) => _context.RewritePath(filePath, pathInfo, queryString, setClientFilePath);

public override void SetSessionStateBehavior(SessionStateBehavior sessionStateBehavior) => _context.SetSessionStateBehavior(sessionStateBehavior);

public override object? GetService(Type serviceType)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use expression instead similar to the rest of the methods

@birojnayak birojnayak force-pushed the HttpContextWrapperFix branch from 6f5b309 to 1de5364 Compare December 9, 2023 02:05
@birojnayak birojnayak force-pushed the HttpContextWrapperFix branch from 1de5364 to f5eda9b Compare December 9, 2023 02:16
Copy link
Member

@twsouthwick twsouthwick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@twsouthwick twsouthwick merged commit aa10c36 into dotnet:main Dec 15, 2023
@birojnayak birojnayak deleted the HttpContextWrapperFix branch December 15, 2023 16:55
birojnayak added a commit to birojnayak/systemweb-adapters that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants