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

Pass go request content by val not ref #3834

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed reflection for Java enum deserialization. [microsoft/kiota-java#843](https://github.com/microsoft/kiota-java/pull/843)
- Added support for AnyOf arrays. [#3786](https://github.com/microsoft/kiota/pull/3792)
- Fixed a bug where property names that matched reserved type would be replaced in dotnet.
- Fixed pass by value for `contentType` param in Go `requestInfo.SetStreamContentAndContentType`[#3830](https://github.com/microsoft/kiota/issues/3830)

## [1.8.2] - 2023-11-08

Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req
if (requestParams.requestBody.Type.Name.Equals("binary", StringComparison.OrdinalIgnoreCase) || requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase))
{
if (requestParams.requestContentType is not null)
writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, {requestParams.requestContentType.Name.ToFirstCharacterLowerCase()})");
writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, *{requestParams.requestContentType.Name.ToFirstCharacterLowerCase()})");
else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType))
writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, \"{codeElement.RequestBodyContentType}\")");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ public void WritesRequestGeneratorBodyUnknownRequestBodyType()
var result = tw.ToString();
Assert.Contains("SetStreamContentAndContentType", result, StringComparison.OrdinalIgnoreCase);
Assert.DoesNotContain("application/json", result, StringComparison.OrdinalIgnoreCase);
Assert.Contains(", requestContentType", result, StringComparison.OrdinalIgnoreCase);
Assert.Contains(", *requestContentType", result, StringComparison.OrdinalIgnoreCase);
AssertExtensions.CurlyBracesAreClosed(result);
}
[Fact]
Expand Down
Loading