Jump to content

HttpRequestOptions RequestContent - type defined in non reference assembly??


chef

Recommended Posts

Maybe a strange question, but MediaBrowser.Common.Net.HttpRequestOptions would like me to add a reference to "System.Memory" in order to fill a POST request with Bytes of data.

 

My concern is that adding references to libraries outside of the MediaBrowser namespace will break .netStandard and its ability to cross platforms.

 

Probably nothing but I wanted to ask. Yep totally confused...again...

 

Here is a code example:


 public void PostDirectiveResponseAsync(AlexaRequest alexaRequest)
        {
            const string uri = "https://api.amazonalexa.com/v1/directives";
            
            var options = new HttpRequestOptions();
            options.RequestHeaders["Authorization"] = "Bearer " + alexaRequest.request.token;
            options.Url = uri;
            options.RequestContentType = "application/json";
            
            var content =
                new ByteArrayContent(
                    Encoding.ASCII.GetBytes(_jsonSerializer.SerializeToString(DirectiveResponseBuilder(alexaRequest.request.requestId,
                            "Accessing Home Theater..."))));

            options.RequestContent  = content; //<--THIS IS THE CODE HERE THAT WANTS "SYSTEM.MEMORY"
            _httpClient.Post(options);


        }

This is the dev environment, if for some reason my question is still wierd:

post-27-0-61667400-1548130443_thumb.png

Edited by chef
Link to comment
Share on other sites

Thank you. 

 

However, there is a chain of references happening here.

 

Now that I have added System Memory, it the environment wants a reference to System.Private.CoreLib.

 

That is fine, but when I go to add the reference, there is an error while adding it.

 

 

post-27-0-62996000-1548162020_thumb.png

 

 

post-27-0-24570400-1548162876_thumb.png

 

 

EDIT: Realizing that I would need to add the reference to these libraries the same way I add MediaBrowser through csproj.

Edited by chef
Link to comment
Share on other sites

In the end this isn't important after all. Sending directive responses to Amazon Alexa doesn't work because emby's endpoints are so fast there is no compute time to access the API. LOL! The response is instantaneous! Which is really cool!

Edited by chef
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...