-
Notifications
You must be signed in to change notification settings - Fork 75
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
Supplement modular azure core basic test case #2236
Conversation
pending 1.2.1 release |
const result = await client.string.put(JSON.stringify("test")); | ||
const result = await client.string.put("test", { | ||
requestOptions: { | ||
headers: { | ||
"content-type": "text/plain" | ||
} | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous way was working because core client rest will set the requested content type as application/json here but will pass undefined when serialize the request body here, and we will fall into the situation here which will pass the '"test"' to the cadl ranch server end,
but with the core-client-rest 1.3.0,
- if we keep passing '"test"' without additional content type information, we will get the into the condition here and get the content type "application/json; charset=UTF-8" and when we serialize the request body with the content type, we will try to JSON.stringify it again. server side will get a """test""".
- if we pass the raw string "test" without the content type, as we have decided, we should just leave the content-type as undefined here we will just send out the raw string to cadl ranch, which is wrong too.
So we have to specify the original string, and the request content type here. and it also works if we set the content type as "application/json".
@joheredi do you think if the core logic is somewhat broken ? or the cureent logic is the right?
Fixes #2207