Fork me on GitHub
#yada
<
2017-05-04
>
danielcompton00:05:13

Sounds like your authorization isn't allowing POST requests?

geek-draven11:05:39

Does anyone have any experience deploying yada on ec2 instances? I've been able to run the jar on my test server, but when I change the name to the configt file to use either the private hostname or ip, I don't get any of the usual messages when I run it nor can I connect to it in the browser. Unfortunately I don't have access to the box, so I'm having to ask the client to open ports or change security settings

runejuhl12:05:46

Hi all. Is it possible to use the yada.yada/response-for with a resource? E.g. something like (yada.yada/response-for ["/foo" (yada.yada/resource {:methods {:get {:response (fn [ctx] "hello")}}})] :get "/foo")?

runejuhl12:05:10

The above results in {:status 406, :headers {"content-length" "18", "content-type" "text/plain;charset=utf-8"}, :body "\r\n\r\n{:status 406}\n"}, which is not really what I wanted 🙂

borkdude12:05:29

Why is an exception on a GET request wrapped inside this? It seems irregular from the other methods. https://github.com/juxt/yada/blob/0a8cd0a1790db6885f835e847bba80796d4f7f79/src/yada/methods.clj#L194

borkdude12:05:22

This makes rendering exception that you throw yourself a bit more cumbersome

borkdude12:05:12

@runejuhl Add :produces "text/html" to the :get

runejuhl13:05:18

@borkdude That did the trick -- thank you!

malcolmsparks13:05:06

@geek-draven yes, lots! I can help. You need to add a route-53 DNS entry and use that in the vhost section. See edge's config.edn

geek-draven14:05:19

thanks @malcolmsparks, life was so much simpler when I only needed to worry about was processing flight data 🙂

sickill14:05:05

Hey. I'm getting Context does not contain a :uri-info entry when trying to use yada/path-for.

sickill14:05:29

The manual says "This feature is only available if your resources are declared in a bidi hierarchical route structure. Otherwise, the URL cannot be determined.", and I am using bidi for routing with yada here

malcolmsparks14:05:50

@sickill are you using bidi's vhosts?

malcolmsparks14:05:11

You can use bidi path-for directly

borkdude14:05:13

We use bidi vhosts with just the wildcard, :*

sickill14:05:14

I read manual's section 5.1.1 and it didn't mention neither vhosts or using bidi directly

sickill14:05:48

ok, need to read about vhosts then 🙂

sickill14:05:15

ah, ok, it's in system.clj

sickill14:05:17

looks, like I'm looking at wrong places all the time 😄

borkdude15:05:48

How can I test a resource including the default interceptor chains? response-for doesn’t seem to do this. Should I start a yada listener in my unit tests?

borkdude16:05:48

Probably the easiest way, maybe not the simple way 😜

borkdude16:05:51

(defmacro with-server
  “Runs resource in server and defines url for use in body”
  [resource & body]
  `(let [resource# ~resource
         vmodel# (vhosts-model [:* [“/api/foo” resource#]])
         listener# (y/listener vmodel#)
         port# (:port listener#)
         close# (:close listener#)
         ~‘url (str “:” port# “/api/foo”)]
     ~@body
     (close#)))

danielcompton23:05:44

I suspect you could call yada.handler/as-handler on your routes or vmodel and get a ring handler back

danielcompton23:05:13

and then you can just call it like (my-handler <ring request map>)