Skip to content

Using HTML examples

Tambapps edited this page Apr 15, 2021 · 5 revisions

Here is an example to configure the client to use HTML with Jsoup

client = new HttpPoet(url: "https://fr.wikipedia.org",
    contentType: ContentType.JSON, acceptContentType: ContentType.HTML).tap {
  parsers[ContentType.HTML] = { def body -> Jsoup.parse(body.string()) }
}

document = client.get("/wiki/Groovy_(langage)")

Clone this wiki locally