Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lipkau committed Dec 30, 2017
1 parent a689061 commit d489174
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 31 deletions.
2 changes: 1 addition & 1 deletion ConfluencePS.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ task Deploy -If (
(-not ($env:APPVEYOR_PULL_REQUEST_NUMBER)) -and
# Do not deploy if the commit contains the string "skip-deploy"
# Meant for major/minor version publishes with a .0 build/patch version (like 2.1.0)
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*'
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*' -and
) {
Remove-Module ConfluencePS -ErrorAction SilentlyContinue
}, PublishToGallery
Expand Down
7 changes: 0 additions & 7 deletions ConfluencePS/ConfluencePS.psm1
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
try {
Add-Type -AssemblyName System.Core
}
catch {
Write-Host "FFFF"
}

# Load the ConfluencePS namespace from C#
if (!("ConfluencePS.Space" -as [Type])) {
Add-Type -Path (Join-Path $PSScriptRoot ConfluencePS.Types.cs) -ReferencedAssemblies Microsoft.CSharp
Expand Down
25 changes: 9 additions & 16 deletions ConfluencePS/Private/Invoke-Method.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ function Invoke-Method {
# pass input to local variable
# this allows to use the PSBoundParameters for recursion
$_headers = @{ # Set any default headers
# "Accept" = "application/json"
# "Accept-Charset" = "utf-8"
"Content-Type" = "application/json; charset=utf-8"
"Accept" = "application/json"
"Accept-Charset" = "utf-8"
}
$Headers.Keys.foreach( { $_headers[$_] = $Headers[$_] })
}
Expand Down Expand Up @@ -102,18 +101,18 @@ function Invoke-Method {
Uri = $URi
Method = $Method
Headers = $_headers
# ContentType = "application/json; charset=utf-8"
ContentType = "application/json; charset=utf-8"
UseBasicParsing = $true
Credential = $Credential
ErrorAction = "Stop"
# Verbose = $false # Overwrites verbose output
Verbose = $false # Overwrites verbose output
}

# if ($_headers.ContainsKey("Content-Type")) {
# $splatParameters["ContentType"] = $_headers["Content-Type"]
# $_headers.Remove("Content-Type")
# $splatParameters["Headers"] = $_headers
# }
if ($_headers.ContainsKey("Content-Type")) {
$splatParameters["ContentType"] = $_headers["Content-Type"]
$_headers.Remove("Content-Type")
$splatParameters["Headers"] = $_headers
}

if ($Body) {
if ($RawBody) {
Expand All @@ -138,17 +137,11 @@ function Invoke-Method {
# This shall be fixed with PoSh v6: /~https://github.com/PowerShell/PowerShell/issues/2193
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Failed to get an answer from the server"
$webResponse = $_
Write-Verbose ($webResponse)
Write-Verbose ($webResponse | Out-String)
Write-Verbose ($webResponse | gm | Out-String)
Write-Verbose ($webResponse.gettype())
if ($webResponse.ErrorDetails) {
Write-Verbose "1"
# In PowerShellCore (v6+), the response body is available as string
$responseBody = $webResponse.ErrorDetails.Message
}
else {
Write-Verbose "2"
$webResponse = $webResponse.Exception.Response
}
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/ConfluencePS.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ InModuleScope ConfluencePS {
}
# $Space3
# Ensure the space doesn't already exist
Get-ConfluenceSpace -Key $Key1 -ErrorAction SilentlyContinue -Verbose #TODO
Get-ConfluenceSpace -Key $Key1 -ErrorAction SilentlyContinue #TODO

# ACT
$NewSpace1 = $Space1 | New-ConfluenceSpace -ErrorAction Stop -Verbose
$NewSpace2 = New-ConfluenceSpace -Key $Key2 -Name $Name2 -Description $Description -ErrorAction Stop -Verbose
$NewSpace1 = $Space1 | New-ConfluenceSpace -ErrorAction Stop
$NewSpace2 = New-ConfluenceSpace -Key $Key2 -Name $Name2 -Description $Description -ErrorAction Stop

# ASSERT
It 'returns an object with specific properties' {
Expand Down
7 changes: 3 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ skip_commits:
files:
- .github/
- .vscode/
- assets/
- Tools/
- README.md
- .gitattributes
- .gitignore
- .env*

# PRs, by definition, don't change anything and therefore should not increment the version
# To be fair, this is not important, and is really just AppVeyor enabling my pedantry
Expand Down Expand Up @@ -80,5 +79,5 @@ deploy:
branch: master # release from master branch only
appveyor_repo_tag: false # deploy on tag push only

on_failure:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

0 comments on commit d489174

Please sign in to comment.