box / box/box-windows-sdk-v2

Expose http response content headers via Box SDK

Open
#796 1 comment 0 reactions 4 assignees Claimed by @mwwoda View on GitHub
enhancement
Dominant language
C#
Stars
183
Forks
160
Avg merge
10h 44m
Merged PRs (30d)
15

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 where T : class
{
...

HttpResponseHeaders Headers { get; set; }

///
/// This could be added
///
HttpContentHeaders ContentHeaders { get; set; }
}
```

```
See Box.V2.Request.HttpRequestHandler line 204 on the main branch

var boxResponse = new BoxResponse
{
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> DownloadStreamAsync(string id, string ...)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.