Comments (5)
Ring is not designed to be a purely functional library, any more than Clojure is. InputStreams are a compromise in the design, but a necessary one, as Clojure has no official I/O library of its own, and lazy seqs lack the performance for dealing with large streams of data.
InputStreams are a bit of a gotcha if you're not familiar with Java's I/O classes, and I'd encourage you to add a page to the wiki to document this potential pitfall. Any GitHub user can edit the wiki; you don't need permission to do so.
It might be possible to write middleware to replace the InputStream with a caching version that can be re-read, without breaking existing functionality. However, this should be tried out as a separate library.
from ring.
I wasn't implying ring was meant to be purely functional. Doesn't mean it doesn't still feel weird to be bit by mutability hiding under the covers. I am very familiar with Java's I/O classes and I understood how inputstreams worked from the very beginning. A big problem is that I had no idea :body
even was an inputstream until I just so happened to look its class up for an unrelated reason.
I can certainly add a wiki page explaining inputstream sematics, but will anybody with this issue actually know what to look for? Is there any point?
from ring.
Perhaps we should document the symptoms, and then suggest the possible cause.
For instance, perhaps a page of common problems, with a section on blank params and a suggestion that this may be caused by the body of the request being consumed.
I was surprised that you didn't know that the request body was an InputStream. Perhaps that could be more prominently documented.
from ring.
The specific reason I didn't know that the body was an inputstream was because of its class name. HttpInput
. Normally input streams are named like HttpInputStream
. That is what put me off.
I think the symptom idea is a good one. I'll get a page started!
from ring.
Thanks in advance for the help!
from ring.
Related Issues (20)
- function ring.util.response/file-response doesn't work with opt. :root like "C:\\" in Windows
- `wrap-nested-params` does not parse `query-params` to produce a nested structure. HOT 3
- Callback after response transmission HOT 2
- ring.util.response/resource-response triggers JDK bug and leaks file descriptors HOT 2
- Consider adding data_readers for clj-time or coercing to timestamp HOT 1
- URL path causes exception in resource middleware HOT 3
- Broken link on https://github.com/ring-clojure/ring/wiki/Creating-responses HOT 2
- Prevent compilation-time jetty log initialization HOT 6
- request: How to register wasm mime on clojure ring server? HOT 2
- Ring Jetty Adapter attempts to handle requests that have already been handled HOT 6
- Release new version of ring-jetty-adapter to avoid CVE-2022-2191 HOT 1
- ring-jetty and timeouts HOT 5
- Can ring use the latest version of Jetty - 9.4.49.v20220914 HOT 1
- upgrade of Apache Commons FileUpload to 1.5 HOT 13
- Websocket support HOT 1
- The AES / CBC algorithm used in the cookie session store _might_ be insecure HOT 3
- Attributes in the `Set-Cookie` header are formatted incorrectly HOT 1
- How to measure time that it takes to complete a request? HOT 2
- Documentation for cookies HOT 2
- How to change UriCompliance mode HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ring.