Giter Site home page Giter Site logo

checked-route's People

Contributors

gregspurrier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

checked-route's Issues

Default error response packager assumes ring/ring-json middleware

I'm either doing something wrong, or perhaps checked-routes don't support routes that look like:

(GET "/performance-overview" { ^{:check (partial val/validation-errors schema)} params :params}
   (do :something))

This is the code from my application. The GET++ just handles some common duplication in the code.

(defmacro ^:private GET++ [route environment schema handler]
  `(cr/checked GET ~route { ^{:check (partial val/validation-errors ~schema)} params# :params}
        (~handler ~environment params#)))
(GET++ "/performance-overview" env performance-overview-params-schema web-pages/performance-overview)

When I hit the route, localhost/performance-overview?foo=1, where this route expects no params whatsoever, it seems like the validation errors were evaluated correctly, but something crazy happens inside ring... Notice the errors showing in the stacktrace (#{"Path [:foo] was not specified in the schema."})

Here's my stacktrace:

2012-11-01 10:45:33.614:WARN:oejs.AbstractHttpConnection:/performance-overview?foo=1
java.lang.Exception: Unrecognized body: {:errors {params__31__auto__ #{"Path [:foo] was not specified in the schema."}}}
at ring.util.servlet$set_body.invoke(servlet.clj:103)
at ring.util.servlet$update_servlet_response.invoke(servlet.clj:112)
at ring.adapter.jetty$proxy_handler$fn__3581.invoke(jetty.clj:21)
at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle(Unknown Source)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:191)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:680)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.