File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,13 +28,13 @@ curl -sf http://localhost:${PORT}/health || { echo "Health check failed"; exit 1
2828
2929# Send request directly to the API endpoint
3030if [ " ${CONTENT_TYPE} " = " multipart/form-data" ]; then
31- # Convert key=value&key2=value2 to -F flags
32- CURL_ARGS=" "
31+ CURL_CMD=(curl -sf -X POST " http://localhost:${PORT}${ROUTE} " )
3332 IFS=' &' read -ra PAIRS <<< " ${REQUEST}"
3433 for pair in " ${PAIRS[@]} " ; do
35- CURL_ARGS= " ${CURL_ARGS} -F ${pair} "
34+ CURL_CMD+=( -F " ${pair} " )
3635 done
37- eval curl -sf -X POST " http://localhost:${PORT}${ROUTE} " ${CURL_ARGS} --output /tmp/omni_response --max-time 300
36+ CURL_CMD+=(--output /tmp/omni_response --max-time 300)
37+ " ${CURL_CMD[@]} "
3838else
3939 curl -sf -X POST " http://localhost:${PORT}${ROUTE} " \
4040 -H " Content-Type: application/json" \
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ curl -sf http://localhost:${PORT}/ping || { echo "Ping failed"; exit 1; }
2828
2929# Send request via /invocations with route header
3030if [ " ${CONTENT_TYPE} " = " multipart/form-data" ]; then
31- CURL_ARGS=" "
31+ CURL_CMD=(curl -sf -X POST " http://localhost:${PORT} /invocations"
32+ -H " X-Amzn-SageMaker-Custom-Attributes: route=${ROUTE} " )
3233 IFS=' &' read -ra PAIRS <<< " ${REQUEST}"
3334 for pair in " ${PAIRS[@]} " ; do
34- CURL_ARGS= " ${CURL_ARGS} -F ${pair} "
35+ CURL_CMD+=( -F " ${pair} " )
3536 done
36- eval curl -sf -X POST " http://localhost:${PORT} /invocations" \
37- -H " X-Amzn-SageMaker-Custom-Attributes: route=${ROUTE} " \
38- ${CURL_ARGS} --output /tmp/omni_response --max-time 300
37+ CURL_CMD+=(--output /tmp/omni_response --max-time 300)
38+ " ${CURL_CMD[@]} "
3939else
4040 curl -sf -X POST http://localhost:${PORT} /invocations \
4141 -H " Content-Type: application/json" \
You can’t perform that action at this time.
0 commit comments