public StreamingBackendResponseResult( StreamingBackendResponse streamingBackendResponse, BackendResponseResultOptions options = default) { _response = streamingBackendResponse; _options = options ?? new BackendResponseResultOptions(); }
public BackendResponseResult( BackendResponse response, BackendResponseResultOptions options = default) { _response = response; _options = options ?? new BackendResponseResultOptions(); Content = response.Content; ContentType = response.ContentType; StatusCode = (int)response.StatusCode; }
public static ActionResult ToActionResult( this IBackendResponse response, BackendResponseResultOptions options = default) { switch (response) { case BackendResponse backendResponse: return(new BackendResponseResult(backendResponse, options)); case StreamingBackendResponse streamingBackendResponse: return(new StreamingBackendResponseResult(streamingBackendResponse, options)); } throw new ArgumentException("response has unsupported type", nameof(response)); }