-
Notifications
You must be signed in to change notification settings - Fork 1
HttpPoem
Tambapps edited this page Jun 3, 2022
·
1 revision
An HttpPoem is a way to write series of request with not much code. It takes a HttpPoet as a context, and it will use it to perform requests specified in the poem.
Simply specify the request method, the query/body parameters, and the HttpPoem will translate it into a request that will be executed by the poet.
poet.poem {
def todos = get '/todos', [author: 'au@thor.me']
post '/todos', [title: 'new post', author: 'me@myself.me']
post "/todos/from/csv", p(author_id: "me"),
b(ContentType.MULTIPART_fORM, file: new FormPart(contentType: ContentType.CSV, value: new File('todo.csv')))
get "/todo/1", h("X-Custom-Header", "MyValue")
}