-
Notifications
You must be signed in to change notification settings - Fork 164
Description
Is your feature request related to a problem? Please describe.
The problem that I am facing is that BoxFilesManager does not provide an API for getting System.IO.Stream related information.
It does not expose 'content-type', 'content-length' nor 'content-disposition' content request headers.
Why am I requesting this?
Box API does not return any whatsoever mime-types.
I don't want to guess the mime-type or parse it on the fly based on the file extension of a BoxFile.
Working with generic mime types could introduce security issues.
I would prefer If I can return the correct mime type to the front-end, so that the browsers knows how to handle it correctly.
Would be happy to hear from you or answer questions.
Thanks!
Describe the solution you'd like
See Box.V2.IBoxResponse
public interface IBoxResponse<T> where T : class
{
...
HttpResponseHeaders Headers { get; set; }
/// <summary>
/// This could be added
/// </summary>
HttpContentHeaders ContentHeaders { get; set; }
}
See Box.V2.Request.HttpRequestHandler line 204 on the main branch
var boxResponse = new BoxResponse<T>
{
Headers = response.Headers,
ContentHeaders = response.Content.Headers,
// Translate the status codes that interest us
StatusCode = response.StatusCode
};
Afterwards we can introduce a new set of BoxFilesManager methods that can return the response itself IBoxResponse<> or we can create a custom return type. No preference about that.
E.g.
Task<IBoxResponse<Stream>> DownloadStreamAsync(string id, string ...)