UnityEditor.RestService.Response.SimpleResponse C# (CSharp) Method

SimpleResponse() private method

private SimpleResponse ( HttpStatusCode status, string payload ) : void
status HttpStatusCode
payload string
return void
        public extern void SimpleResponse(HttpStatusCode status, string payload);
    }

Usage Example

Example #1
0
        private static void CallSafely(Request request, string payload, Response writeResponse, Func <Request, JSONValue, JSONValue> method)
        {
            RestRequestException exception;

            try
            {
                JSONValue value2 = 0;
                if (payload.Trim().Length == 0)
                {
                    value2 = new JSONValue();
                }
                else
                {
                    try
                    {
                        value2 = new JSONParser(request.Payload).Parse();
                    }
                    catch (JSONParseException)
                    {
                        ThrowInvalidJSONException();
                    }
                }
                writeResponse.SimpleResponse(HttpStatusCode.Ok, method(request, value2).ToString());
            }
            catch (JSONTypeException)
            {
                ThrowInvalidJSONException();
            }
            catch (KeyNotFoundException)
            {
                exception = new RestRequestException {
                    HttpStatusCode = HttpStatusCode.BadRequest
                };
                RespondWithException(writeResponse, exception);
            }
            catch (RestRequestException exception2)
            {
                RespondWithException(writeResponse, exception2);
            }
            catch (Exception exception3)
            {
                exception = new RestRequestException {
                    HttpStatusCode       = HttpStatusCode.InternalServerError,
                    RestErrorString      = "InternalServerError",
                    RestErrorDescription = "Caught exception while fulfilling request: " + exception3
                };
                RespondWithException(writeResponse, exception);
            }
        }
All Usage Examples Of UnityEditor.RestService.Response::SimpleResponse