예제 #1
0
 public static UnityWebRequestBuilder SetJsonBody(this UnityWebRequestBuilder requestBuilder, object model, JsonSerializerSettings jsonSettings = null)
 {
     jsonSettings        = jsonSettings ?? new JsonSerializerSettings();
     requestBuilder.Body = JsonConvert.SerializeObject(model, jsonSettings);
     requestBuilder.AddHeader("Content-Type", "application/json");
     return(requestBuilder);
 }
예제 #2
0
        public static UnityWebRequestBuilder AddBasicAuthHeader(this UnityWebRequestBuilder requestBuilder, string login, string password)
        {
            string encodedCredentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(login + ":" + password));

            return(requestBuilder.AddHeader("Authorization", "Basic " + encodedCredentials));
        }