HttpResponse.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Net;
  5. namespace MediaBrowser.Model.Net
  6. {
  7. public class HttpResponse : IDisposable
  8. {
  9. /// <summary>
  10. /// Gets or sets the type of the content.
  11. /// </summary>
  12. /// <value>The type of the content.</value>
  13. public string ContentType { get; set; }
  14. /// <summary>
  15. /// Gets or sets the response URL.
  16. /// </summary>
  17. /// <value>The response URL.</value>
  18. public string ResponseUrl { get; set; }
  19. /// <summary>
  20. /// Gets or sets the content.
  21. /// </summary>
  22. /// <value>The content.</value>
  23. public Stream Content { get; set; }
  24. /// <summary>
  25. /// Gets or sets the status code.
  26. /// </summary>
  27. /// <value>The status code.</value>
  28. public HttpStatusCode StatusCode { get; set; }
  29. /// <summary>
  30. /// Gets or sets the length of the content.
  31. /// </summary>
  32. /// <value>The length of the content.</value>
  33. public long? ContentLength { get; set; }
  34. /// <summary>
  35. /// Gets or sets the headers.
  36. /// </summary>
  37. /// <value>The headers.</value>
  38. public Dictionary<string, string> Headers { get; set; }
  39. private readonly IDisposable _disposable;
  40. public HttpResponse(IDisposable disposable)
  41. {
  42. _disposable = disposable;
  43. }
  44. public HttpResponse()
  45. {
  46. }
  47. public void Dispose()
  48. {
  49. if (_disposable != null)
  50. {
  51. _disposable.Dispose();
  52. }
  53. }
  54. }
  55. }