@@ -131,7 +131,7 @@ components (path, host, and so forth).
131131- Parse and validate a URL from an ASCII or a valid UTF-8 string.
132132
133133```cpp
134- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
134+ auto url = ada::parse("https://www.google.com");
135135if (url) { /* URL is valid */ }
136136```
137137
@@ -140,14 +140,14 @@ accessing it when you are not sure that it will succeed. The following
140140code is unsafe:
141141
142142``` cpp
143- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" some bad url" );
143+ auto url = ada::parse(" some bad url" );
144144url->get_href ();
145145```
146146
147147You should do...
148148
149149``` cpp
150- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" some bad url" );
150+ auto url = ada::parse(" some bad url" );
151151if (url) {
152152 // next line is now safe:
153153 url->get_href();
@@ -165,7 +165,7 @@ UTF-8 strings.
165165- Get/Update credentials
166166
167167``` cpp
168- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
168+ auto url = ada::parse(" https://www.google.com" );
169169url->set_username ("username");
170170url->set_password("password");
171171// ada->get_href() will return "https://username:password@www.google.com/ "
@@ -174,7 +174,7 @@ url->set_password("password");
174174- Get/Update Protocol
175175
176176```cpp
177- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
177+ auto url = ada::parse("https://www.google.com");
178178url->set_protocol("wss");
179179// url->get_protocol() will return "wss:"
180180// url->get_href() will return "wss://www.google.com/"
@@ -183,7 +183,7 @@ url->set_protocol("wss");
183183- Get/Update host
184184
185185``` cpp
186- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
186+ auto url = ada::parse(" https://www.google.com" );
187187url->set_host ("github.com");
188188// url->get_host() will return "github.com"
189189// you can use ` url.set_hostname ` depending on your usage.
@@ -192,31 +192,31 @@ url->set_host("github.com");
192192- Get/Update port
193193
194194```cpp
195- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
195+ auto url = ada::parse("https://www.google.com");
196196url->set_port("8080");
197197// url->get_port() will return "8080"
198198```
199199
200200- Get/Update pathname
201201
202202``` cpp
203- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
203+ auto url = ada::parse(" https://www.google.com" );
204204url->set_pathname ("/my-super-long-path")
205205// url->get_pathname() will return "/my-super-long-path"
206206```
207207
208208- Get/Update search/query
209209
210210```cpp
211- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
211+ auto url = ada::parse("https://www.google.com");
212212url->set_search("target=self");
213213// url->get_search() will return "?target=self"
214214```
215215
216216- Get/Update hash/fragment
217217
218218``` cpp
219- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
219+ auto url = ada::parse(" https://www.google.com" );
220220url->set_hash ("is-this-the-real-life");
221221// url->get_hash() will return "#is-this-the-real-life"
222222```
0 commit comments