Skip to content

Commit 408bc29

Browse files
authored
[WX-1393] Add Content Length to Curl request (#7328)
1 parent 84b4480 commit 408bc29

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

supportedBackends/tes/src/main/scala/cromwell/backend/impl/tes/TesAsyncBackendJobExecutionActor.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ object TesAsyncBackendJobExecutionActor {
100100
| exit 1
101101
| fi
102102
|fi
103-
|
103+
|curl --version
104+
|jq --version
104105
|# Acquire bearer token, relying on the User Assigned Managed Identity of this VM.
105106
|echo Acquiring Bearer Token using User Assigned Managed Identity...
106107
|BEARER_TOKEN=$$(curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F' -H Metadata:true -s | jq .access_token)
107-
|
108108
|# Remove the leading and trailing quotes
109109
|BEARER_TOKEN="$${BEARER_TOKEN#\\"}"
110110
|BEARER_TOKEN="$${BEARER_TOKEN%\\"}"
@@ -117,7 +117,9 @@ object TesAsyncBackendJobExecutionActor {
117117
| -X POST "$getSasWsmEndpoint" \\
118118
| -H "Content-Type: application/json" \\
119119
| -H "accept: */*" \\
120-
| -H "Authorization: Bearer $${BEARER_TOKEN}")
120+
| -H "Authorization: Bearer $${BEARER_TOKEN}" \\
121+
| -H "Content-Length: 0" \\
122+
| -d "")
121123
|
122124
|# Store token as environment variable
123125
|export $environmentVariableName=$$(echo "$${sas_response_json}" | jq -r '.token')

supportedBackends/tes/src/test/scala/cromwell/backend/impl/tes/TesAsyncBackendJobExecutionActorSpec.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ class TesAsyncBackendJobExecutionActorSpec extends AnyFlatSpec with Matchers wit
141141
| -X POST "$expectedEndpoint" \\
142142
| -H "Content-Type: application/json" \\
143143
| -H "accept: */*" \\
144-
| -H "Authorization: Bearer $${BEARER_TOKEN}")
144+
| -H "Authorization: Bearer $${BEARER_TOKEN}" \\
145+
| -H "Content-Length: 0" \\
146+
| -d "")
145147
|""".stripMargin
146148
val exportCommandSubstring = s"""export $mockEnvironmentVariableNameFromWom=$$(echo "$${sas_response_json}" | jq -r '.token')"""
147149
val echoCommandSubstring = s"""echo "Saving sas token: $${$mockEnvironmentVariableNameFromWom:0:4}**** to environment variable $mockEnvironmentVariableNameFromWom...""""

0 commit comments

Comments
 (0)