Class MicroServer
A minimalistic HTTP server that only serves a single file on localhost. Useful for unit tests.
[CLSCompliant(false)]
public sealed class MicroServer : HttpServer
- Inheritance
-
objectMicroServer
- Inherited Members
- Extension Methods
Constructors
MicroServer(string, Stream)
Starts serving a single file via HTTP on localhost.
public MicroServer(string resourceName, Stream fileContent)
Parameters
resourceName
stringThe HTTP resource name under which to provide the content.
fileContent
StreamThe content of the file to serve.
Properties
FileContent
The content of the file to be served under FileUri.
public Stream FileContent { get; }
Property Value
- Stream
FileUri
The complete URL under which the server provides its file.
public Uri FileUri { get; }
Property Value
- Uri
ServerUri
The URL under which the server root can be reached. Usually you should use FileUri instead.
public Uri ServerUri { get; }
Property Value
- Uri
Slow
Wait for twenty seconds every time before finishing a response.
public bool Slow { get; set; }
Property Value
- bool
Methods
HandleRequest(HttpListenerContext)
Handles a single HTTP request.
protected override void HandleRequest(HttpListenerContext context)
Parameters
context
HttpListenerContext