Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mint - Disrupting HTTP clients
Search
Andrea Leopardi
August 29, 2019
Programming
0
200
Mint - Disrupting HTTP clients
Andrea Leopardi
August 29, 2019
Tweet
Share
More Decks by Andrea Leopardi
See All by Andrea Leopardi
BEAM: The Perfect Fit for Networks
whatyouhide
1
120
Update from the Elixir team - 2022
whatyouhide
0
330
Testing Asynchronous OTP
whatyouhide
0
440
Elixir Sightseeing Tour
whatyouhide
0
320
BEAM Architecture Handbook
whatyouhide
7
2.5k
The Evolution of a Language
whatyouhide
0
110
Elixir - functional, concurrent, distributed programming for the rest of us
whatyouhide
2
290
Papers we love: Elixir edition
whatyouhide
5
970
Update from the Elixir team - 2018
whatyouhide
2
4.4k
Other Decks in Programming
See All in Programming
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
900
Goのmultiple errorsについて (2024年4月版)
syumai
3
580
Elm 0.19.0 Changes
bkuhlmann
0
490
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
430
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
900
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
360
Hanami and htmx
bkuhlmann
0
210
PostmanでAPIの動作確認が楽になった話
h455h1
0
160
新宿ダンジョンを可視化してみた
satoshi7190
2
240
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
10 Git Anti Patterns You Should be Aware of
lemiorhan
648
58k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Building Better People: How to give real-time feedback that sticks.
wjessup
355
18k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Learning to Love Humans: Emotional Interface Design
aarron
267
39k
The Cost Of JavaScript in 2023
addyosmani
16
3.8k
Bash Introduction
62gerente
604
210k
Statistics for Hackers
jakevdp
789
220k
[RailsConf 2023] Rails as a piece of cake
palkan
23
3.9k
Transcript
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
{:ok, conn} = Mint.HTTP.connect( :https, "example.com", 80 ) conn #=>
%Mint.HTTP1{...}
{:ok, conn, request_ref} = Mint.HTTP.request( conn, "GET", "/", [{"content-type", "text/html"}]
)
None
{:ok, conn, request_ref} = Mint.HTTP.request(...)
None
None
None
receive do message -> Mint.HTTP.stream(conn, message) end
case Mint.HTTP.stream(conn, message) do :unknown -> # ... {:ok, conn,
responses} -> # ... {:error, conn, reason, responses} -> # ... end
{:status, ref, 200} {:headers, ref, [...]} {:data, ref, "...chunk..."} {:done,
ref} {:error, ref, reason}
None
None
None
:inets.start() :ssl.start() :httpc.request( 'https://self-signed.badssl.com' ) #=> {:ok, {{'HTTP/1.1', 200, 'OK'}...}
:hackney.request( :get, "https://self-signed.badssl.com", _headers = [], _body = "", _opts
= [] ) #=> {:error, {:tls_alert, ...}}
:hackney.request( :get, "https://self-signed.badssl.com", _headers = [], _body = "", ssl_options:
[versions: [:"tlsv1.2"]] ) #=> {:ok, 200, ...}
Mint.HTTP.connect( :https, "https://self-signed.badssl.com", 443 ) #=> {:error, %Mint.TransportError{...}}
None
None
defp deps do [ # ..., {:mint, "~> 0.4"}, {:castore,
"~> 0.1"} ] end
None
None
proxy = { :http, "proxy.example.com", 80, _opts = [] }
Mint.HTTP.connect( :https, "httpbin.org", 443, proxy: proxy )
None
None
None
None
None
{ :push_promise, ref, promised_ref, promised_headers }
None
{:ok, conn, ref} = Mint.HTTP2.ping(conn) # ... response #=> {:pong,
^ref}
None
Mint.HTTP.connect(...) Mint.HTTP1.connect(...) Mint.HTTP2.connect(...)
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None