https://github.com/jkroso/http.jl
An HTTP client and server for Julia
https://github.com/jkroso/http.jl
http julia
Last synced: 8 months ago
JSON representation
An HTTP client and server for Julia
- Host: GitHub
- URL: https://github.com/jkroso/http.jl
- Owner: jkroso
- Created: 2014-09-08T04:32:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-06-23T03:26:34.000Z (almost 2 years ago)
- Last Synced: 2025-05-14T09:56:05.915Z (11 months ago)
- Topics: http, julia
- Language: Julia
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# HTTP.jl
A client and server side implementation of HTTP for Julia.
To use it you will need the [Kip](https://github.com/jkroso/Kip.jl) module system.
The client returns a `Response` object which contains all the meta data needed to parse the response data into a rich data type such as HTML nodes or JSON objects. Or because `Response` is also an IO, you can just work directly with the bytes stream.
```Julia
@use "github.com/jkroso/HTTP.jl/client" GET PUT
read(GET("google.com"), String) # a string of html
write("google.html", GET("google.com")) # downloads to an html file
@use "github.com/jkroso/DOM.jl/html"
dom = parse(GET("google.com")) # a DOM object
write(PUT("gewgle.com"), MIME("text/html"), dom)
```
This library also provides a `Session` type that keeps track of cookies, reuses sockets, and provides a ORM like API for interacting with HTTP servers
```julia
@use "github.com/jkroso/HTTP.jl/client/Session" Session
httpbin = Session("httpbin.org")
response = httpbin["/cookies/set?a=1"]
parse(MIME"application/json", response) == Dict("cookies"=>Dict("a"=>1))
```