PATCH /issues/{issueNumber} returns "The given key 'Content-Type' was not present in the dictionary." #110246
-
Select Topic AreaBug BodyI've been using a PowerShell script in a GitHub Action workflow to close issues programmatically for several months. Starting last week, the script's first call to add a comment to the issue succeeds, but a subsequent call using the same headers (including the Authorization header) fails to set the state of the issue to closed. Instead,
I've performed the following troubleshooting:
This leads me to believe the issue is with the GitHub Actions execution environment changing or the API specification changing without notification. Any suggestions on how to debug further? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
We are running into this in the dotnet/aspnetcore repo as well. It seems like a break in github API as this same code worked 2 days ago and only started failing recently. |
Beta Was this translation helpful? Give feedback.
-
As a workaround you can add This worked for me: |
Beta Was this translation helpful? Give feedback.
-
It's not just limited to GitHub. I'm getting it as well in the Cisco AsyncOS API. The API call to release a message from quarantine works, but the call to delete it fails. The only difference between the two calls is the method (POST vs DELETE), and one additional property in the JSON request body for the release. This started as soon as I upgraded from .NET 7 to .NET 8. Adding a |
Beta Was this translation helpful? Give feedback.
-
Thanks for flagging this issue! It seems like there might be a problem with the request headers. Make sure to include the 'Content-Type' header in your PATCH request. Hope this helps! |
Beta Was this translation helpful? Give feedback.
As a workaround you can add
Content-Type
to your$headers
variable.This worked for me:
$headers += @{"Content-Type"="text/json"}