Skip to content

Commit

Permalink
fix: fix cast abi-encode command (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnkz authored Oct 26, 2023
1 parent abc012e commit b340aaf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/_internal/Request.sol
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ library LibRequestClient {

script = string.concat(
script,
');reverse_response=$(echo "$response" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");headers=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR==2" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");code=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR==1" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");body=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR>2" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");cast abi-encode "response(uint256,string,string)" "$code" "$body" "$headers";'
");",
'reverse_response=$(echo "$response" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");',
'headers=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR==2" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");',
'code=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR==1" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");',
'body=$(echo "$reverse_response" | awk -v RS="\\n\\n" "NR>2" | awk "{a[i++]=\\$0} END {for (j=i-1; j>=0;) print a[j--]}");',
'cast abi-encode "response(uint256,string,string)" "$code" \\\'"$body"\\\' \\\'"$headers"\\\';'
);

// The script to obtain the response body, status code and headers looks like this:
Expand Down

0 comments on commit b340aaf

Please sign in to comment.