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/fixes#326 #335

Closed
wants to merge 7 commits into from
Closed

bug/fixes#326 #335

wants to merge 7 commits into from

Conversation

SebastianSchuetze
Copy link
Collaborator

@SebastianSchuetze SebastianSchuetze commented Jun 20, 2020

Fixes #326

fix the encoding issue for all future cmdlets. Added a default ContentType with JSON and UTF8 encoding if not specified otherwise. Also removed the encoding from the build/release definition functions to have default UTF 8.

Additionally, I added integration tests for handling release definitions with special characters in them.

@@ -63,6 +63,11 @@ function _callAPI {
$params.Add('Uri', $Url)
$params.Add('UserAgent', (_getUserAgent))

#always use utf8 and json as default content type instead of xml
if ($false -eq $PSBoundParameters.ContainsKey("ContentType")) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarqueWarrior can you check if you agree? I thing it is a good approach because

  1. we use json by default anyways and never xml
  2. UTF8 should always be used if not configured otherwise.

A next step could be to remove the content types in all the other cmdlet so this problem does not occur anymore. We had this now the third time.

@DarqueWarrior
Copy link
Collaborator

Running tests now.

@DarqueWarrior
Copy link
Collaborator

I have no idea why I can never push changes to your branches. I will push to another branch and merge

@DarqueWarrior DarqueWarrior mentioned this pull request Jul 28, 2020
3 tasks
@DarqueWarrior
Copy link
Collaborator

Merging from another branch that includes my changes.

$tmpReleaseDef1 = (New-TemporaryFile).FullName
$srcReleaseDef | ConvertTo-Json -Depth 10 | Set-Content -Path $tmpReleaseDef1

Invoke-VSTeamRequest -ProjectName $newProjectName -Method Post -SubDomain vsrm -Area Release -Resource definitions -Version "5.1" -InFile $tmpReleaseDef1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard coding the version will cause these tests to fail on TFS.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused of what you are trying to do here. Why are you using Invoke-VSTeamRequest?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the version is corrected it appears to work on TFS2018 and above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think have the tests fixed now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for correcting! I don't know anymore why I used the wrong command for testing release definitions. Doesn't make sense to me anymore. Maybe a brain hickup...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update-VSTeamRelease WARNING: VS402865: An empty body in the POST request is not allowed.
2 participants