Skip to content

Commit

Permalink
Fix http section documentation (#32)
Browse files Browse the repository at this point in the history
* Update invalid link to the example

* Wrong first type of parameter given to NewHTTPRequest function
  • Loading branch information
Zwiterrion authored Mar 18, 2024
1 parent fae85da commit 8d2782c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ extism call plugin.wasm log_stuff --wasi --log-level=trace
## HTTP

Sometimes it is useful to let a plug-in [make HTTP calls](https://pkg.go.dev/github.com/extism/go-pdk#HTTPRequest.Send). [See this example](example/http.go)
Sometimes it is useful to let a plug-in [make HTTP calls](https://pkg.go.dev/github.com/extism/go-pdk#HTTPRequest.Send). [See this example](example/http/tiny_main.go)

```go
//export http_get
func httpGet() int32 {
// create an HTTP Request (withuot relying on WASI), set headers as needed
req := pdk.NewHTTPRequest("GET", "https://jsonplaceholder.typicode.com/todos/1")
req := pdk.NewHTTPRequest(pdk.MethodGet, "https://jsonplaceholder.typicode.com/todos/1")
req.SetHeader("some-name", "some-value")
req.SetHeader("another", "again")
// send the request, get response back (can check status on response via res.Status())
Expand Down

0 comments on commit 8d2782c

Please sign in to comment.