Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

cypress graphql request

    const query = `{
        findUser(username:"hello")
        {
            id
        }
    }`;

    cy.request(
        {
            url: 'http://localhost/graphql/',  // graphql endpoint
            body: { query },  // or { query: query } depending if you are writing with es6
            failOnStatusCode: false  // not a must but in case the fail code is not 200 / 400
        }
    ).then((res) => {
        cy.log(res);
    })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cypress #graphql #request
ADD COMMENT
Topic
Name
1+7 =