Skip to content

Conversation

@gummikonsumer
Copy link

@gummikonsumer gummikonsumer commented Jun 22, 2024

Resolves #75

The tests seem sort of hard to add a new client to, so I skipped it, but I implemented the actual functionality. Additionally, https://mylibrary.io/graphql-public seems down, and I can't get the demo-project to build as it is. This is a pretty simple change, though, and I tested with this code:

import { Client, setDefaultClient } from './dist/index.min.js'

const client = new Client({
  endpoint: 'http://localhost:3000/api',
  fetchOptions: { method: 'POST' }
})

setDefaultClient(client)

const QUERY_TEST = `
{
  hello(name: "David")
}
`

console.log(await client.runQuery(QUERY_TEST, {}))

on a POST-only graphql server, I get this:

{ data: { hello: 'Hello David' } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help: How do I use POST?

2 participants