Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Sphyrnidae.Common.Extensions.HttpResponseExtensions Class Reference

Extension methods for HttpRequest More...

Static Public Member Functions

static void SetHeader (this HttpResponse response, string key, string value)
 Adds a header to the HttpResponse message More...
 
static Task< string > GetBodyAsync (this HttpResponse response)
 Retrieves the body of a request as a string More...
 
static Task ReplaceBodyAsync (this HttpResponse response, string str)
 Retrieves the body of a response as a string More...
 
static Task WriteResponseAsync (this HttpResponse response, IApiResponse obj, JsonSerializerSettings json)
 Writes out a custom response More...
 

Detailed Description

Extension methods for HttpRequest

Member Function Documentation

◆ GetBodyAsync()

static Task<string> Sphyrnidae.Common.Extensions.HttpResponseExtensions.GetBodyAsync ( this HttpResponse  response)
static

Retrieves the body of a request as a string

Can't read a PipeWriter, so continue to do this one as a stream

Parameters
responseThe current http response
Returns
The full body of the request

◆ ReplaceBodyAsync()

static Task Sphyrnidae.Common.Extensions.HttpResponseExtensions.ReplaceBodyAsync ( this HttpResponse  response,
string  str 
)
static

Retrieves the body of a response as a string

Parameters
responseThe current http response
strThe string value of the body (usually object serialized to json)

◆ SetHeader()

static void Sphyrnidae.Common.Extensions.HttpResponseExtensions.SetHeader ( this HttpResponse  response,
string  key,
string  value 
)
static

Adds a header to the HttpResponse message

Parameters
responseThe current http response
keyThe name of the header
valueThe value of the header

◆ WriteResponseAsync()

static Task Sphyrnidae.Common.Extensions.HttpResponseExtensions.WriteResponseAsync ( this HttpResponse  response,
IApiResponse  obj,
JsonSerializerSettings  json 
)
static

Writes out a custom response

Parameters
responseThe current http response
objThe object to write out
jsonJson serialization settings
Returns

The documentation for this class was generated from the following file: