Skip to content

Conversation

@EmondDeW
Copy link

The virtual indexer of the base class (HttpRequestBase) throws NotImplementedException.

This implementation follows the order of probing of the collection that is used in HttpRequest.

public override string ContentType { get { return _originalRequest.ContentType; } set { } }
public override System.Text.Encoding ContentEncoding { get { return _originalRequest.ContentEncoding; } set { } }
public override RequestContext RequestContext { get; set; }
public override string this[string key] => QueryString[key] ?? Form[key] ?? Cookies[key]?.Value ?? ServerVariables[key];

Choose a reason for hiding this comment

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

Or you could also

Suggested change
public override string this[string key] => QueryString[key] ?? Form[key] ?? Cookies[key]?.Value ?? ServerVariables[key];
public override string this[string key] => _originalRequest[key];

Copy link
Author

Choose a reason for hiding this comment

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

Yes, but I am not sure if/what EMPTYHttpRequest should return in the first place... I just don't want it to throw

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