Files
codeql/ql/test/library-tests/frameworks/http_clients/NetHttp.rb
Harry Maclean a9c00a05fe HTTP -> Http
Change the capitalisation of HTTP to Http, to conform to the QL style
guide.

Leave the HTTP module in Concepts alone, so it remains consistent with
the Concepts in other language libraries.
2021-09-29 13:50:05 +01:00

28 lines
417 B
Ruby

require "net/http"
uri = URI.parse("https://example.com")
Net::HTTP.get(uri)
resp = Net::HTTP.post(URI.parse(uri), "some_body")
resp.body
resp.read_body
resp.entity
req = Net::HTTP.new("https://example.com")
r1 = req.get("/")
r2 = req.post("/")
r3 = req.put("/")
r4 = req.patch("/")
r1.body
r2.read_body
r3.entity
r4.foo
def get(domain, path)
Net::HTTP.new(domain).get(path)
end
get("example.com", "/").body