Skip to content

Instantly share code, notes, and snippets.

@lbradstreet
Created April 21, 2016 11:25
Show Gist options
  • Save lbradstreet/4fe2af7ceefcc734bfca29b14871328b to your computer and use it in GitHub Desktop.
Save lbradstreet/4fe2af7ceefcc734bfca29b14871328b to your computer and use it in GitHub Desktop.
(ns onyx.plugin.http-output-gzip-test
(:require [clojure.core.async :refer [go chan >! >!! <!! close!]]
[clojure.test :refer [deftest is]]
[taoensso.timbre :refer [info]]
[onyx.test-helper :refer [with-test-env]]
[onyx.plugin.core-async :refer [take-segments!]]
[onyx.plugin.http-output]
[qbits.jet.server]
[onyx.api])
(:import [java.util.zip GZIPOutputStream]
[java.io ByteArrayOutputStream]))
(defn str->gzip [s encoding]
(let [baos (ByteArrayOutputStream.)
gzos (GZIPOutputStream. baos)]
(.write gzos (.getBytes s encoding))
(.close gzos)
(.toByteArray baos)))
(def messages
[{:url "http://localhost:41300/" :args {:body (str->gzip "d=3" "UTF-8")
:as :json
:headers {"Content-Type" "application/json"
"Content-Encoding" "gzip"}}}
:done])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment