Forum Xamarin.Forms

Using HttpClient with Xamarin.Forms how to add "Request-type: NewMango"

JitendraJitendra USMember ✭✭

how to add Request-type: NewMango I have tried with several forum and google but couldn't find solution can you please let me know how to add Request-type in Xamarin.foms?

Thank you,
Jitendra Jadav

Best Answer

  • JitendraJitendra USMember ✭✭
    edited January 2018 Accepted Answer

    Hi all, thank you I got my answer please check below:

    HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, uri); requestMessage.Headers.Add("Request-type", "NewMango"); requestMessage.Content = content; HttpResponseMessage response = null; response = await client.SendAsync(requestMessage);

Answers

  • SreeeeSreeee INMember ✭✭✭✭✭

    I didn't get you completely. Are you asking about setting the key for an item that is sending to the server through web service? If yes look the following link:

    https://forums.xamarin.com/discussion/104757/xamarin-webservice#latest

  • JitendraJitendra USMember ✭✭

    Hi @Sreeee No it is not keyvalue pair but something "HttpRequestMessage"
    I don't know how to create it

  • SreeeeSreeee INMember ✭✭✭✭✭

    Are you trying a post web service by passing a json?
    Something similar to the following link:
    https://forums.xamarin.com/discussion/104757/xamarin-webservice#latest

  • JitendraJitendra USMember ✭✭
    edited January 2018 Accepted Answer

    Hi all, thank you I got my answer please check below:

    HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, uri); requestMessage.Headers.Add("Request-type", "NewMango"); requestMessage.Content = content; HttpResponseMessage response = null; response = await client.SendAsync(requestMessage);

  • SreeeeSreeee INMember ✭✭✭✭✭

    @Jitendra said:
    Hi all, thank you I got my answer please check below:

    HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, uri); requestMessage.Headers.Add("Request-type", "NewMango"); requestMessage.Content = content; HttpResponseMessage response = null; response = await client.SendAsync(requestMessage);

    Finally, you got answer, great :)
    Please use the quote option when giving reply to comment. It will give notification to the commented guy, otherwise, we don't know about your reply.

Sign In or Register to comment.