oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
525 stars 42 forks source link

`response-for` gives me `nil` #134

Closed rgkirch closed 2 years ago

rgkirch commented 2 years ago

I'm trying to use martian but any call I make with response-for gives me nil. I've tried in clojure and clojurescript.

src/my/ns.cljc

(ns my.ns
  (:require
   #?(:cljs [cljs.core.async :as async :refer [<! >!] :refer-macros [go]]
      :clj [clojure.core.async :as async :refer [<! <!! >! >!! go]])
   [martian.core :as martian]
   #?(:clj [martian.clj-http :as martian-http]
      :cljs [martian.cljs-http :as martian-http])))

(def m (martian/bootstrap "http://icanhazip.com"
                          [{:route-name :ip
                            :path-parts []
                            :method :get}]))

(martian/response-for m :ip)
;; nil

(martian/url-for m :ip)
;; "http://icanhazip.com"

(martian/request-for m :ip)
;; {:method :get, :url "http://icanhazip.com"}

project.clj

(defproject martian-broke "0.0.1"
  :dependencies [[org.clojure/clojure "1.11.0-alpha2"]
                 [org.clojure/core.async "1.3.618"]
                 [com.github.oliyh/martian "0.1.20"]
                 [com.github.oliyh/martian-clj-http "0.1.20"]
                 [com.github.oliyh/martian-vcr "0.1.20"]]
  :source-paths ["src"]
  :test-paths ["test"])
oliyh commented 2 years ago

Hi,

You need to use martian-http/bootstrap to get the interceptors that perform the request.

Hope this helps Cheers

rgkirch commented 2 years ago

Thanks!