<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged http</title>
<link>https://ask.clojure.org/index.php/tag/http</link>
<description></description>
<item>
<title>Consider including a built-in wrapper around `java.net.http.HttpClient` in future versions of Clojure</title>
<link>https://ask.clojure.org/index.php/15129/consider-including-wrapper-around-httpclient-versions-clojure</link>
<description>&lt;p&gt;Java 9 introduced &lt;code&gt;java.net.http.HttpClient&lt;/code&gt;[1] with support for HTTP/1.1, HTTP/2 as well as WebSocket along with other features. It was later standardized in Java 11[2] and has become one of the top picks for Java programs. The latest version of the HTTP client shipped with Java 26 also added support for HTTP/3.[3] &lt;/p&gt;
&lt;p&gt;It would be nice for future versions of Clojure that are based on Java 11+ to include a new namespace with wrapper functions around &lt;code&gt;java.net.http.HttpClient&lt;/code&gt; to make it easier (without all the OOP ceremonies) to work with HTTP in Clojure programs out of the box without relying on any 3rd-party libraries.&lt;/p&gt;
&lt;p&gt;Examples of prior art:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/gnarroway/hato&quot;&gt;https://github.com/gnarroway/hato&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/schmee/java-http-clj&quot;&gt;https://github.com/schmee/java-http-clj&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/babashka/http-client&quot;&gt;https://github.com/babashka/http-client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://central.sonatype.com/artifact/com.cognitect/http-client&quot;&gt;https://central.sonatype.com/artifact/com.cognitect/http-client&lt;/a&gt;&lt;br&gt;
(upcoming?)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[1] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/110&quot;&gt;https://openjdk.org/jeps/110&lt;/a&gt;&lt;br&gt;
[2] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/321&quot;&gt;https://openjdk.org/jeps/321&lt;/a&gt;&lt;br&gt;
[3] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/517&quot;&gt;https://openjdk.org/jeps/517&lt;/a&gt;&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15129/consider-including-wrapper-around-httpclient-versions-clojure</guid>
<pubDate>Mon, 08 Jun 2026 01:37:14 +0000</pubDate>
</item>
<item>
<title>how to start a web server in dev mode in an interactive mode with hot reload and refresh</title>
<link>https://ask.clojure.org/index.php/12933/start-server-mode-interactive-mode-with-reload-and-refresh</link>
<description>&lt;p&gt;Hello wonderful clojure community.&lt;br&gt;
I am new to clojure so appologies for my dump question.&lt;/p&gt;
&lt;p&gt;I want to write a http server in clojure and for that there a a few libraries/frameworks available. but what is important for me is the interactive development experience, how?&lt;/p&gt;
&lt;p&gt;ok, I want to start the server and if I change a module/namespace I want it to be automatically reload (actually I've already achieved this) however on top of it I want the frontend to get refreshed automatically to to refelect the changes. I use hiccup to describe/render my html pages, unfortunately though for any change I need to manually refresh the page.&lt;/p&gt;
&lt;p&gt;I know there should be a (websocket based) solution to make this possible.&lt;/p&gt;
&lt;p&gt;I want this soution to work with clojure, I do not use/want clojurescrip.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12933/start-server-mode-interactive-mode-with-reload-and-refresh</guid>
<pubDate>Fri, 12 May 2023 08:20:46 +0000</pubDate>
</item>
<item>
<title>Reading a JSON stream over HTTP, indefinitely?</title>
<link>https://ask.clojure.org/index.php/9128/reading-a-json-stream-over-http-indefinitely</link>
<description>&lt;p&gt;I am trying to read a &lt;code&gt;json&lt;/code&gt; HTTP stream and use the &lt;code&gt;json&lt;/code&gt; elements, indefinitely.&lt;/p&gt;
&lt;p&gt;I came up with this code below, but it does close the stream and only returns 30 results - how do I &lt;em&gt;indefinitely&lt;/em&gt; use the HTTP stream?&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns core
  (:require [clj-http.client :as http]
            [cheshire.core :as json]
            [clojure.java.io :as io]
            [clojure.core.async :as async]))

(def gh-url &quot;https://api.github.com/events&quot;)
(def chan (async/chan 100))

(async/go
  (loop [r (async/&amp;lt;! chan)]
    (when (not-empty r) (println (:type r)))
    (recur (async/&amp;lt;! chan))))

(defn read-gh-stream [url]
  (with-open [stream (-&amp;gt; url (http/get {:as :stream}) :body)]
    (let [lines (-&amp;gt; stream io/reader (json/parse-stream true))]
      (doseq [l lines]
        (async/go
          (async/&amp;gt;! chan l))))))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>IO</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9128/reading-a-json-stream-over-http-indefinitely</guid>
<pubDate>Sat, 29 Feb 2020 07:59:50 +0000</pubDate>
</item>
<item>
<title>How to do a HTTP request over a unix socket in Clojure</title>
<link>https://ask.clojure.org/index.php/8990/how-to-do-a-http-request-over-a-unix-socket-in-clojure</link>
<description>&lt;p&gt;I want to a HTTP request over a UNIX socket, like the following example using curl and docker:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ curl --unix-socket /var/run/docker.sock http://localhost/images/json
[
  {
    &quot;Containers&quot;: -1,
    &quot;Created&quot;: 1577395270,
    &quot;Id&quot;: &quot;sha256:ce6c1e7ac56533e2742030f033cf0d8cf0adc996c7bb87453eb5adc266b2ef2e&quot;,
    &quot;Labels&quot;: null,
    &quot;ParentId&quot;: &quot;&quot;,
    &quot;RepoDigests&quot;: [
      &quot;busybox@sha256:7fe0cb3632d9ea7b2a9ab4427e339e01f7cdfeff50674804cb8946664976c610&quot;
    ],
    &quot;RepoTags&quot;: [
      &quot;busybox:musl&quot;
    ],
    &quot;SharedSize&quot;: -1,
    &quot;Size&quot;: 1461385,
    &quot;VirtualSize&quot;: 1461385
  }
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As far as I've seen, clj-http doesn't seem to support this.&lt;/p&gt;
&lt;p&gt;What would be a recommended/idiomatic way of doing this in Clojure?&lt;/p&gt;
</description>
<category>Libs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8990/how-to-do-a-http-request-over-a-unix-socket-in-clojure</guid>
<pubDate>Sat, 04 Jan 2020 15:08:16 +0000</pubDate>
</item>
</channel>
</rss>