Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: HttpContent.SetHeader failing when secret header already exists #1479

Open
1 task done
vody opened this issue Jul 3, 2024 · 4 comments
Open
1 task done

[Bug]: HttpContent.SetHeader failing when secret header already exists #1479

vody opened this issue Jul 3, 2024 · 4 comments
Assignees
Labels
Approved The issue is approved Bug Something isn't working Integration GitHub request for Integration area

Comments

@vody
Copy link

vody commented Jul 3, 2024

Describe the issue

The "Http Content" codeunit throws an error message when content is defined from SecretText.

Error message: 
Cannot add value because the header 'Content-Type' does not support multiple values.

AL call stack: 
"Http Content Impl."(CodeUnit 2355).SetHeader line 12 - System Application by Microsoft
"Http Content Impl."(CodeUnit 2355).SetContentTypeHeader line 4 - System Application by Microsoft
"Http Content Impl."(CodeUnit 2355).SetContent line 6 - System Application by Microsoft
"Http Content"(CodeUnit 2354).SetContent line 2 - System Application by Microsoft
"Http Content"(CodeUnit 2354).Create line 2 - System Application by Microsoft\"Http Content"(CodeUnit 2354).Create line 2 - System Application by Microsoft

This happens because inside "Http Content Impl.".SetHeader procedure Headers.Contains(Name) condition will return false for a secret header, which will be automatically created when we set a content from the SecretText value.

Expected behavior

Content will be defined with a new header without error.

Steps to reproduce

codeunit 50000 SetHeader
{
    trigger OnRun()
    var
        HttpContent: Codeunit "Http Content";
    begin
        HttpContent.Create(SecretStrSubstNo('anything'));
    end;
}

Additional context

No response

I will provide a fix for a bug

  • I will provide a fix for a bug
@vody vody added the Bug Something isn't working label Jul 3, 2024
@JesperSchulz JesperSchulz added the Approved The issue is approved label Jul 8, 2024
@JesperSchulz
Copy link
Contributor

@ajkauffmann has agreed to include this in a pull request he is working on anyway 🥳
I cannot assign it to him (seems I can only assign to people who have been active on the issue), but consider it assigned 😉

@ajkauffmann
Copy link
Contributor

I'm active now. 😊
Yes, happy to take this one!

@JesperSchulz
Copy link
Contributor

And now I could assign you 🥳

@vody
Copy link
Author

vody commented Sep 15, 2024

@ajkauffmann thank you for picking this one. We tried to use it internally to promote open-source contribution within an organization but it was pushed down in priority.

@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved The issue is approved Bug Something isn't working Integration GitHub request for Integration area
Projects
None yet
Development

No branches or pull requests

3 participants