d6f79edae2
- start using `GET` and query parameters instead of `POST` when meaningful - inline parsed protocol data and metadata in block headers - inline parsed protocol data and metadata in operations - split the RPC in four categories: - static data, available explicitly in block headers and operations - static "metadata", information that were computed while validating a block or an operation, but which are not explicit in the block header (e.g. the baker of a block, the list of internal transfer... (currently not implemented, but that's WIP)) - "context" all the static data we may read in the context (contracts balance, list of delegates, ...) - "helpers" are some RPC that may perform some computation.
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
## from genesis to demo
|
|
|
|
set -e
|
|
|
|
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
|
|
source $test_dir/test_lib.inc.sh "$@"
|
|
|
|
start_node 1 --cors-origin "*"
|
|
|
|
show_logs="no"
|
|
|
|
sleep 2
|
|
|
|
run_preflight() {
|
|
local origin="$1"
|
|
local method="$2"
|
|
local cors_method="$3"
|
|
local header="$4"
|
|
curl -H "Origin: $origin" \
|
|
-H "Access-Control-Request-Method: $cors_method" \
|
|
-H "Access-Control-Request-Headers: $header" \
|
|
-X $method \
|
|
-I -s http://localhost:18731/chains/main/blocks/head/header/shell > CURL.$id 2>&1
|
|
}
|
|
|
|
run_request() {
|
|
local origin="$1"
|
|
curl -H "Origin: $origin" \
|
|
-H "Content-Type: application/json" \
|
|
-D CURL.$id \
|
|
-s http://localhost:18731/chains/main/blocks/head/header/shell 2>&1 > /dev/null
|
|
}
|
|
|
|
# Preflight
|
|
run_preflight "localhost" "OPTIONS" "GET" "Content-Type"
|
|
cat CURL.$id
|
|
grep -q "access-control-allow-origin" CURL.$id
|
|
grep -q "access-control-allow-methods" CURL.$id
|
|
grep -q "access-control-allow-headers" CURL.$id
|
|
|
|
# Request
|
|
run_request "localhost"
|
|
cat CURL.$id
|
|
grep -q "access-control-allow-origin" CURL.$id
|
|
|
|
echo
|
|
echo End of test
|
|
echo
|