@@ -10,7 +10,6 @@ template = "doc.html"
10- [Authenticating](#authenticating)
10- [Authenticating](#authenticating)
11- [Using the Channel System](#using-the-channel-system)
11- [Using the Channel System](#using-the-channel-system)
12- [Scrying](#scrying)
12- [Scrying](#scrying)
13−- [Running Threads With Spider](#running-threads-with-spider)
14- [Direct HTTP Handling With Gall Agents](#direct-http-handling-with-gall-agents)
13- [Direct HTTP Handling With Gall Agents](#direct-http-handling-with-gall-agents)
15- [Generators](#generators)
14- [Generators](#generators)
16- [Managing CORS Origins](#managing-cors-origins)
15- [Managing CORS Origins](#managing-cors-origins)
@@ -214,52 +213,6 @@ content-type: text/html
214<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>There was an error while handling the request for /foo/bar/baz.json.</p><code>no scry result</code></body></html>
213<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>There was an error while handling the request for /foo/bar/baz.json.</p><code>no scry result</code></body></html>
217−# Running Threads With Spider
219−Here we'll look at running Spider threads through Eyre. You can refer to the [Spider](@/docs/arvo/eyre/external-api-ref.md#spider) section of the [External API Reference](@/docs/arvo/eyre/external-api-ref.md) document for relevant details.
221−Here's an extremely simple thread that takes a `vase` of `(unit json)` and just returns the `json` in a new `vase`. You can save it in `/ted` and `|commit %home`:
227−=, strand=strand:spider
233− (need !<((unit json) arg))
237−First we must obtain a session cookie by [authenticating](#authenticating).
239−Now we can try and run our thread. Spider (the Gall agent that manages threads) is bound to the `/spider` URL path, and expects the rest of the path to be `/{inputMark}/{thread}/{outputMark}`. Our `{thread}` is called `eyre-thread`, and both its `{inputMark}` and `{outputMark}` are `json`, so our URL path will be `/spider/json/eyre-agent/json`. Our request will be an HTTP POST request and the body will be some `json`, in this case `[{"foo": "bar"}]`:
242−curl -i --header "Content-Type: application/json" \
243− --cookie "urbauth-~zod=0v6.h6t4q.2tkui.oeaqu.nihh9.i0qv6" \
245− --data '[{"foo": "bar"}]' \
246− http://localhost:8080/spider/json/eyre-thread/json
249−Spider will run the thread and the result will be returned through Eyre in the body of an HTTP response with a 200 status code:
253−Date: Sun, 06 Jun 2021 05:32:45 GMT
254−Connection: keep-alive
255−Server: urbit/vere-1.5
256−set-cookie: urbauth-~zod=0v6.h6t4q.2tkui.oeaqu.nihh9.i0qv6; Path=/; Max-Age=604800
257−content-type: application/json
258−transfer-encoding: chunked
263# Direct HTTP Handling With Gall Agents
216# Direct HTTP Handling With Gall Agents
265In many cases you'll just want to interact with Gall agents through the JSON API of the channel system, but it's also possible to bypass all that and just deal with HTTP requests directly. Here we'll take a look at how that practically works.
218In many cases you'll just want to interact with Gall agents through the JSON API of the channel system, but it's also possible to bypass all that and just deal with HTTP requests directly. Here we'll take a look at how that practically works.