Skip to content

Commit e18767f

Browse files
committed
updated README
1 parent cd95964 commit e18767f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ if err := client.Run(ctx, req, &respData); err != nil {
5151
}
5252
```
5353

54+
### File support via multipart form data
55+
56+
By default, the package will send a JSON body. To enable the sending of files, you can opt to
57+
use multipart form data instead using the `UseMultipartForm` option when you create your `Client`:
58+
59+
```
60+
client := graphql.NewClient("https://machinebox.io/graphql", graphql.UseMultipartForm())
61+
```
62+
5463
For more information, [read the godoc package documentation](http://godoc.org/github.com/machinebox/graphql) or the [blog post](https://blog.machinebox.io/a-graphql-client-library-for-go-5bffd0455878).
5564

5665
## Thanks

graphql_multipart_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestWithClient(t *testing.T) {
2727
}
2828

2929
ctx := context.Background()
30-
client := NewClient("", WithHTTPClient(testClient))
30+
client := NewClient("", WithHTTPClient(testClient), UseMultipartForm())
3131

3232
req := NewRequest(``)
3333
client.Run(ctx, req, nil)

0 commit comments

Comments
 (0)