.Net Core 2.1 Api passing same header parameter multiple times
In the Api controller, one action takes a header parameters and for testing this action i'm trying to pass same parameter multiple time..
expected behavior is that this parameter should be overwritten or take the first value.
but the actual result is that i'm receiving a string contains combines all of them (',' separated)..


any help please.
.net-core asp.net-core-2.1 asp.net-apicontroller
add a comment |
In the Api controller, one action takes a header parameters and for testing this action i'm trying to pass same parameter multiple time..
expected behavior is that this parameter should be overwritten or take the first value.
but the actual result is that i'm receiving a string contains combines all of them (',' separated)..


any help please.
.net-core asp.net-core-2.1 asp.net-apicontroller
add a comment |
In the Api controller, one action takes a header parameters and for testing this action i'm trying to pass same parameter multiple time..
expected behavior is that this parameter should be overwritten or take the first value.
but the actual result is that i'm receiving a string contains combines all of them (',' separated)..


any help please.
.net-core asp.net-core-2.1 asp.net-apicontroller
In the Api controller, one action takes a header parameters and for testing this action i'm trying to pass same parameter multiple time..
expected behavior is that this parameter should be overwritten or take the first value.
but the actual result is that i'm receiving a string contains combines all of them (',' separated)..


any help please.
.net-core asp.net-core-2.1 asp.net-apicontroller
.net-core asp.net-core-2.1 asp.net-apicontroller
asked 17 hours ago
Bassem MamarBassem Mamar
23119
23119
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
expected behavior is that this parameter should be overwritten or take the first value.
This is not expected behavior defined by the HTTP standard, in which multiple header fields with the same name are allowed:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something likevalue.Split(",")[0]or watch and remove duplicates before posting on the client if you have control over that.
– Zabavsky
14 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54250496%2fnet-core-2-1-api-passing-same-header-parameter-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
expected behavior is that this parameter should be overwritten or take the first value.
This is not expected behavior defined by the HTTP standard, in which multiple header fields with the same name are allowed:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something likevalue.Split(",")[0]or watch and remove duplicates before posting on the client if you have control over that.
– Zabavsky
14 hours ago
add a comment |
expected behavior is that this parameter should be overwritten or take the first value.
This is not expected behavior defined by the HTTP standard, in which multiple header fields with the same name are allowed:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something likevalue.Split(",")[0]or watch and remove duplicates before posting on the client if you have control over that.
– Zabavsky
14 hours ago
add a comment |
expected behavior is that this parameter should be overwritten or take the first value.
This is not expected behavior defined by the HTTP standard, in which multiple header fields with the same name are allowed:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
expected behavior is that this parameter should be overwritten or take the first value.
This is not expected behavior defined by the HTTP standard, in which multiple header fields with the same name are allowed:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.
answered 16 hours ago
ZabavskyZabavsky
10.4k53666
10.4k53666
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something likevalue.Split(",")[0]or watch and remove duplicates before posting on the client if you have control over that.
– Zabavsky
14 hours ago
add a comment |
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something likevalue.Split(",")[0]or watch and remove duplicates before posting on the client if you have control over that.
– Zabavsky
14 hours ago
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
Thanks, what i meant by "expected behavior" is what i need, so is there a way to do override or take first parameter if it passed multiple time, rather than manually check for duplication?
– Bassem Mamar
14 hours ago
@BassemMamar I think you would need to do something like
value.Split(",")[0] or watch and remove duplicates before posting on the client if you have control over that.– Zabavsky
14 hours ago
@BassemMamar I think you would need to do something like
value.Split(",")[0] or watch and remove duplicates before posting on the client if you have control over that.– Zabavsky
14 hours ago
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54250496%2fnet-core-2-1-api-passing-same-header-parameter-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown