79712492

Date: 2025-07-23 19:58:12
Score: 0.5
Natty:
Report link

@mass-dot-net:

Resolving the Cookies problem just requires creating your own implementation of HttpCookies that you can instantiate:

public class FakeHttpCookies : HttpCookies
{
  public override void Append(string name, string value)
  {
    throw new NotImplementedException();
  }
  
  public override void Append(IHttpCookie cookie)
  {
    throw new NotImplementedException();
  }
  
  public override IHttpCookie CreateNew()
  {
    throw new NotImplementedException();
  }
}

Now you can set the value in the MockHttpResponseData constructor:

public MockHttpResponseData(FunctionContext functionContext, HttpCookies? cookies = null) : base(functionContext)
{
  Cookies = cookies ?? new FakeHttpCookies();
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @mass-dot-net
  • Low reputation (0.5):
Posted by: ncsu95