You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment it seems like only binary content can be provided as a file path.
For some requests, e.g. GraphQL to properly check coverage, the query might be > 1000 lines, and the schema might cover 100s of Query and Mutation endpoints. It's completely impractical to paste the raw query in every single spec file.
Using the example from the readme:
meta:
name: GraphQL location service
configuration:
host: api.graphloc.com
scheme: https
specs:
- name: Get Location of a given ip address
request:
method: post
path: /graphql
headers:
- name: content-type
value: application/json
payload:
body:
type: json
content:
query: >
{
getLocation(ip: "8.8.8.8") {
country {
iso_code
}
}
}
variables: null
operationName: null
response:
status_code: 200
json_data:
- path: $.data.getLocation.country.iso_code
value: US
It would be very useful for payload.body.content.query to be a file path rather than an inline query.
The text was updated successfully, but these errors were encountered:
@benjamin-rood That's a good feature to have. Adding it to backlog.
Meanwhile, you can still read request payload from JSON files as done below
Note: CustomRequire and CustomPath are regular js require and path modules exported in c.js which runs as part of configuration of a suite.
meta:
name: POST raw body requests (json , text, binary )
configuration:
custom_configuration:
run_type: module
module:
module_path: ./c.js
function_name: main
specs:
- name: JSON data (file) as body
before_test:
run_type: inline
inline:
function: !!js/function >
function() {
const payload = CustomRequire(CustomPath.resolve(process.cwd(), "p.json"));
this.test.payload = {body: {type: 'json', content: payload}};
}
request:
path: /echoBinaryBodyResponseStats
method: post
headers:
- name: content-type
value: application/json
response:
status_code: 200
json_data:
- path: $.request_content_size
value: 12371
At the moment it seems like only binary content can be provided as a file path.
For some requests, e.g. GraphQL to properly check coverage, the query might be > 1000 lines, and the schema might cover 100s of
Query
andMutation
endpoints. It's completely impractical to paste the raw query in every single spec file.Using the example from the readme:
It would be very useful for
payload.body.content.query
to be a file path rather than an inline query.The text was updated successfully, but these errors were encountered: