Class ServiceHeaderUtils
Helper methods for managing HTTP headers.
Inherited Members
Namespace: Unity.Cloud.Common
Assembly: Unity.Cloud.Common.dll
Syntax
public static class ServiceHeaderUtils
  Fields
k_ApiSourceHeader
Header for the API source information.
Declaration
public const string k_ApiSourceHeader = "X-Unity-Cloud-Api-Source"
  Field Value
| Type | Description | 
|---|---|
| string | 
k_BasicScheme
The basic scheme for authorization.
Declaration
public const string k_BasicScheme = "Basic"
  Field Value
| Type | Description | 
|---|---|
| string | 
k_BearerScheme
The bearer scheme for authorization.
Declaration
public const string k_BearerScheme = "Bearer"
  Field Value
| Type | Description | 
|---|---|
| string | 
k_UnityApiPattern
A regex pattern matching Unity API URLs.
Declaration
public const string k_UnityApiPattern = "https.*(?:[./])unity\\.com/api/.*|localhost:.*\\/api/.*|https.*(?:[./])services.api.unity.com"
  Field Value
| Type | Description | 
|---|---|
| string | 
Methods
AddAppIdAndClientTrace(HttpHeaders, AppId, string)
Adds the HTTP headers with specific values for app Id and client trace.
Declaration
public static void AddAppIdAndClientTrace(this HttpHeaders headers, AppId appId, string clientTrace)
  Parameters
| Type | Name | Description | 
|---|---|---|
| HttpHeaders | headers | The HTTP headers to add to.  | 
      
| AppId | appId | The app Id.  | 
      
| string | clientTrace | The client trace.  | 
      
AddAuthorization(HttpHeaders, string, string)
Add the HTTP header with a specific value for authorization.
Declaration
public static void AddAuthorization(this HttpHeaders headers, string authValue, string authScheme)
  Parameters
| Type | Name | Description | 
|---|---|---|
| HttpHeaders | headers | The HTTP headers to add to.  | 
      
| string | authValue | The authorization value.  | 
      
| string | authScheme | The authorization scheme. Set to "Bearer" by default.  | 
      
AddHeadersAsQuery(Uri, HttpHeaders)
Add HTTP headers to the specified Uri as query arguments.
Declaration
public static Uri AddHeadersAsQuery(this Uri uri, HttpHeaders headers)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Uri | uri | The Uri to add HTTP headers as queries to.  | 
      
| HttpHeaders | headers | The HTTP headers to append as queries.  | 
      
Returns
| Type | Description | 
|---|---|
| Uri | The modified Uri.  | 
      
GetHeaderValue(ApiSourceVersion)
Returns the data contained in the ApiSourceVersion formatted as a string for the HTTP header value.
Declaration
public static string GetHeaderValue(this ApiSourceVersion apiSourceVersion)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ApiSourceVersion | apiSourceVersion | The version information with which to generate the header value.  | 
      
Returns
| Type | Description | 
|---|---|
| string | The contents ApiSourceVersion formatted as a string for the HTTP header value.  |