Fork me on GitHub
#pedestal
<
2016-10-17
>
eric.vieira21:10:15

Hi, I`m trying to send a request with a :delete params and :body. however, don`t acess body in interception and handler before it changes to table-routes.

eric.vieira21:10:45

example:

(response-for test-utils/service :delete  “/entity"  :body  “….”)

mtnygard21:10:02

Hi @eric.vieira, I might be able to help. This is in testing?

eric.vieira21:10:44

th request :post is ok … but request :delete no access body-params

mtnygard21:10:55

Can you paste your routes?

eric.vieira21:10:20

(def routes
  (table/table-routes
    {}
    [
     ["/“ :post (public-interceptors home-page) :route-name :main]
     ["/" :delete (auth-interceptors delete-entidade) :route-name :main-delete]
]
    )
  )

mtnygard21:10:56

That part looks OK. What is in the auth-interceptors function?

eric.vieira21:10:31

list of intercpetors

mtnygard21:10:20

Does that list include the interceptor returned from the body-params function?

eric.vieira21:10:41

(defn auth-interceptors [handler] [ error-handler/interceptor-error-handler (body-params/body-params) {:name :json-body :enter nil :leave parser/json->body} {:name ::auth :enter auth/token->auth :leave auth/auth->token} {:name :json-edn :enter parser/json->edn :leave parser/edn->json} handler] )

eric.vieira21:10:38

the problem is not acess body in request :delete .. in :post it is OK

mtnygard21:10:22

And you are not doing anything to set the Content-Type header on the test requests, right?

mtnygard21:10:50

I'm going to make a quick test app and see what's going on. I'll be back in a few minutes.

eric.vieira21:10:31

find error.. miss set :headers {"Content-Type" "application/json"}

mtnygard21:10:51

I'm glad you found the problem!