-2

As I understand it, it should be possible to set the content of a response message like so:

let responseMessage = new HttpResponseMessage(HttpStatusCode.OK)
responseMessage.Content = new StringContent("test")

However, when doing so I get the following error:

Parser Error: This expression was expected to have type HttpContent but here has type StringContent

I'm doing this in a tests project in order to stub a response. It's targeting .NET 4.5 and FSharp Core 4.3.1.0

Paul Young
  • 1,489
  • 1
  • 15
  • 34

1 Answers1

1

As ildjarn said, = is equality comparison, <- is assignment.

let responseMessage = new HttpResponseMessage(HttpStatusCode.OK)
responseMessage.Content <- new StringContent("test")
Foole
  • 4,754
  • 1
  • 26
  • 23