I'm working on a module that needs to send a POST request with a header and get a valid 200 response. However, whenever I try to make the request, I get this error:
This is what my code looks like and every time I run it, it just stalls out and returns with a 500 error and shows the error above. It seems like its not using the API key.
This is a valid request:
curl -X 'POST' \ 'https://staging.manage.enshield.com/api/auth' \ -H 'accept: */*' \ -H 'X-Api-Key: xxxxxxx' \ -H 'X-CSRF-TOKEN: ' \ -d ''
So is this:
POST /api/auth HTTP/1.1
Accept: */*
Accept-Encoding: deflate, gzip
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Host: staging.manage.enshield.com
X-Api-Key: xxxxxx
Content-Type: application/json
Content-Length: 0
So I'm not sure why the MivaScript code isn't valid
Error Code: | MER-URL-TASK-2 | |
Description: | Failed To Update: Unable to open URL 'https://staging.manage.enshield.com/api/auth': Error connecting to staging.manage.enshield.com on port 443: Connection timed out |
Code:
<MvASSIGN NAME="l.header" VALUE="{ 'accept: */*' $ asciichar( 13 ) $ asciichar( 10 ) }"> <MvASSIGN NAME="l.header" VALUE="{l.header $ 'Content-Length: 0' $ asciichar( 13 ) $ asciichar( 10 ) }"> <MvASSIGN NAME="l.header" VALUE="{ l.header $ 'Content-Type: application/json' $ asciichar(13) $ asciichar(10) }"> <MvASSIGN NAME="l.header" VALUE="{l.header $ 'X-Api-Key: xxxxxxxx ' $ asciichar( 13 ) $ asciichar( 10 ) }"> <MvCALL ACTION = "{l.url}" METHOD = "POST" HEADERS="{ l.header }" CONTENT-TYPE = "application/json" > <MvASSIGN NAME="l.response_header" VALUE="{s.callreturnheader1}"> <MvASSIGN NAME="l.response" VALUE="{l.response $ callvalue}"> </MvCALL> <MvIF EXPR="{l.response_header EQ 'HTTP/1.1 200 OK'}"> ... <MvELSE> ... <MvFUNCRETURN VALUE="0"> </MvIF>
This is a valid request:
curl -X 'POST' \ 'https://staging.manage.enshield.com/api/auth' \ -H 'accept: */*' \ -H 'X-Api-Key: xxxxxxx' \ -H 'X-CSRF-TOKEN: ' \ -d ''
So is this:
POST /api/auth HTTP/1.1
Accept: */*
Accept-Encoding: deflate, gzip
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Host: staging.manage.enshield.com
X-Api-Key: xxxxxx
Content-Type: application/json
Content-Length: 0
So I'm not sure why the MivaScript code isn't valid
Comment