Interface IResponseCallbacks
Callback interface to allow tests to supply runtime logic for responses
Namespace: FakeHttp
Assembly: FakeHttp.dll
Syntax
public interface IResponseCallbacks
Properties
| Improve this Doc View SourceFilterCommonSensitiveValues
Flag indicating whether to automatically filter commonly used header and query parameter names such as X-API-KEY, api-key, key, etc from being serialized
Declaration
bool FilterCommonSensitiveValues { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
FilteredHeaderNames
A list of header names that will not be serialized. For example x-api-key may not be something to store
Declaration
IEnumerable<string> FilteredHeaderNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<String> |
FilteredParameterNames
A list of query parameter names that will not be serialized
Declaration
IEnumerable<string> FilteredParameterNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<String> |
SetHeaderDate
Flag indicating whether to automatically set the Date header to the current date/time on deserialization
Declaration
bool SetHeaderDate { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceDeserialized(ResponseInfo, Stream)
Called just before the response is returned. Update deserialized values as necessary Primarily for cases where time based header values (like content expiration) need up to date values
Declaration
Stream Deserialized(ResponseInfo info, Stream content)
Parameters
Type | Name | Description |
---|---|---|
ResponseInfo | info | Deserialized response data. Header collections can be modified. Might be null if content file but no response file is present |
Stream | content | The deserialized content stream. Might be null if response has no content |
Returns
Type | Description |
---|---|
Stream | The original content or a modified content stream to attach to the HttpResponseMessage |
FilterParameter(String, String)
Determines if a given query parameter should be excluded from serialization
Declaration
bool FilterParameter(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the Uri query parameter |
String | value | The value of the uri query parameter |
Returns
Type | Description |
---|---|
Boolean | True to filter the parameter. False to include in serialization and hashing |
Serializing(HttpResponseMessage)
Called after content is retrieved from the actual service during capturing and before it is saved to disk. Primarily allows for response content to mask sensitive data (ex SSN or other PII) before it is saved to storage
Declaration
Task<Stream> Serializing(HttpResponseMessage response)
Parameters
Type | Name | Description |
---|---|---|
HttpResponseMessage | response | The service response |
Returns
Type | Description |
---|---|
Task<Stream> | The original content or a modified content stream to save to storage |