Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id : Go6n1osPYozXZiQgpFWwLc
Small and medium business | Business Central, N...
Suggested answer

System.InvalidOperationException: Misused header name.

Like (0) ShareShare
ReportReport
Posted on 21 Dec 2021 01:10:31 by 5
Hi Team,
I'm having an issue with a POST request from BC when trying to set the Content-Type header... code snippet below.
MyContent.WriteFrom('{"query": "{boards(limit: 1){id name}}"}');
        MyContent.GetHeaders(Headers);
        Headers.Remove('Content-Type');
        Headers.Add('Content-Type''application/json');
        Headers.Add('Authorization', #####);
        MyContent.GetHeaders(Headers);

        //Load the content into the request
        Request.Content := MyContent;
        Request.Method := 'POST';
        Request.SetRequestUri(#####);

        Client.Send(Request, ResponseMessage);
this results in a System.InvalidOperationException: Misused header name error.
Any ideas?
Much Appreciated!
  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on 21 Dec 2021 at 06:54:52
    RE: System.InvalidOperationException: Misused header name.

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans