hibri / HttpMock

A library for creating Http servers on the fly in tests and stubbing responses
MIT License
128 stars 44 forks source link

Content-Type is always text/plain #98

Closed malves closed 6 years ago

malves commented 6 years ago

Hi,

I am doing some tests with HttpMock, for each response I receive the Content-Type header is set to text/plain. I have added .AddHeader("Content-Type", "text/html") to my setup to force the header to text/html but my header is overridden:

server
                .Stub(x => x.Get("/" + pageName))
                .AddHeader("Content-Type", "text/html")
                .Return(@"
                     <html>
                         <head>
                         </head>
                         <body>
                             <a href='http://localhost:4242/Test1'>Test 1</a>
                             <a href='http://localhost:4242/Test2'>Test 2</a>
                             <a href='http://localhost:4242/Test3'>Test 3</a>
                             <a href='http://google.fr'>Test 3</a>
                         </body>
                     </html>
                 ")
                 .OK();

Is there a way to have the content-type header set to another value ?

Thank you

malves commented 6 years ago

I did not see the AsContentType() method, it's working now.

Sorry