File tree 3 files changed +38
-2
lines changed
3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,8 @@ local function set_headers(request)
250
250
end
251
251
252
252
local function process_graphql (request )
253
- local is_graphql = PARSER_UTILS .contains_meta_tag (request , " graphql" )
253
+ local is_graphql = request .method == " GRAPHQL"
254
+ or PARSER_UTILS .contains_meta_tag (request , " graphql" )
254
255
or PARSER_UTILS .contains_header (request .headers , " x-request-type" , " graphql" )
255
256
256
257
if request .body and # request .body > 0 and is_graphql then
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ export TERM=xterm-color
4
+
3
5
if ! command -v nvim & > /dev/null; then
4
6
echo " nvim is not installed"
5
7
exit 1
@@ -31,7 +33,7 @@ run() {
31
33
if [[ -n $1 ]]; then
32
34
nvim -l tests/minit.lua tests --filter " $1 "
33
35
else
34
- nvim -l tests/minit.lua tests
36
+ nvim -l tests/minit.lua tests -o utfTerminal -Xoutput --color
35
37
fi
36
38
}
37
39
Original file line number Diff line number Diff line change @@ -416,6 +416,39 @@ describe("requests", function()
416
416
assert .has_string (request_body_computed , ' "variables":{"id":1}' )
417
417
end )
418
418
419
+ it (" runs GraphQL request method" , function ()
420
+ curl .stub ({
421
+ [" https://countries.trevorblades.com" ] = {
422
+ body = h .load_fixture (" fixtures/graphql_schema_body.txt" ),
423
+ },
424
+ })
425
+
426
+ h .create_buf (
427
+ ([[
428
+ GRAPHQL https://countries.trevorblades.com
429
+
430
+ query Person($id: ID) {
431
+ person(personID: $id) {
432
+ name
433
+ }
434
+ }
435
+
436
+ {
437
+ "id": 1
438
+ }
439
+ ]] ):to_table (true ),
440
+ " test.http"
441
+ )
442
+
443
+ kulala .run ()
444
+ wait_for_requests (1 )
445
+
446
+ local request_body_computed = DB .data .current_request .body_computed
447
+
448
+ assert .has_string (request_body_computed , ' "query":"query Person($id: ID) { person(personID: $id) { name } }' )
449
+ assert .has_string (request_body_computed , ' "variables":{"id":1}' )
450
+ end )
451
+
419
452
it (" runs API callbacks" , function ()
420
453
curl .stub ({
421
454
[" https://httpbin.org/simple" ] = {
You can’t perform that action at this time.
0 commit comments