Questions tagged [hyper]

A fast and correct HTTP implementation for Rust.

Hyper is a fast, safe HTTP implementation written in and for Rust.

  • A Client for talking to web services.
  • A Server for building those web services.
  • Blazing fast* thanks to Rust.
  • High concurrency with non-blocking sockets.
  • HTTP/1 and HTTP/2 support.

Github Repository

Guide

256 questions
1
vote
1 answer

No method named `post` found for type `hyper::Client` in Hyper 0.11

I want use to Hyper for crafting HTTP requests. Calling Client::get works fine but other methods such as Client::post and Client::head cause an compilation error. extern crate futures; extern crate hyper; extern crate tokio_core; use…
1
vote
1 answer

What might cause a difficult-to-reproduce truncation of a Hyper HTTP response?

I am experiencing a bug where my Hyper HTTP response is being truncated to a specific size (7829 bytes). Making the same request with cURL works fine. The request queries a JSON endpoint for data. The response struct is then shuffled around a lot,…
Dominykas Mostauskis
  • 7,797
  • 3
  • 48
  • 67
1
vote
1 answer

Why can I pass a reference to a non-static local variable to a function which has a 'static bound?

I have problems understanding why it is possible to write code like extern crate futures; extern crate hyper; use hyper::server::{Http, Request, Response, Service}; struct Environment {} struct HttpService<'a> { pub env: &'a…
ensc
  • 6,704
  • 14
  • 22
1
vote
3 answers

How to get the cookie from a GET response?

I am writing a function that makes a GET request to a website and returns the response cookie: extern crate futures; extern crate hyper; extern crate tokio_core; use tokio_core::reactor::Core; use hyper::Client; use std::error::Error; use…
serge1peshcoff
  • 4,342
  • 11
  • 45
  • 76
1
vote
0 answers

Any advise for using Hyper in Rust

I've been looking for any working examples and good documentation for the hyper crate in rust and came across an example here. However, when I run that example I get several errors. error[E0061]: this function takes 1 parameter but 0 parameters were…
crazy_greg
  • 11
  • 2
1
vote
2 answers

Is there a way I can add basic auth to the proxy when I'm using reqwest's client builder?

I'm trying to use Reqwest's proxy feature to pass user:pass basic auth with the rest of the URL into the proxy function. Apparently, the way this crate works basic auth can't be passed this way for the proxy. When I commented out proxy I got my…
Joe
  • 39
  • 7
1
vote
1 answer

Reuse hyper::client and tokio_core in Iron and Hyper

I make a client request inside an Iron handler. How can I reuse Tokio's Core and Hyper's Client? I'm using hyper 0.11.0 and tokio-core 0.1. fn get_result(req: &mut Request) -> IronResult { let mut payload = String::new(); …
Vishal Kumar
  • 762
  • 1
  • 7
  • 15
1
vote
1 answer

How can I convert a struct or JSON into a raw string?

I have tests and I need to send JSON data to my server. I have the following test: extern crate hyper; extern crate rustc_serialize; use std::io::Read; use hyper::*; #[derive(RustcDecodable, RustcEncodable)] struct LegacyJsonRequest { …
arthas_dk
  • 443
  • 5
  • 15
1
vote
1 answer

"macro undefined" error while compiling hyper 0.9.17

I'm trying to build a web service with Iron using this source as a tutorial, but I'm getting errors during compilation of hyper: Compiling hyper…
dnlkng
  • 829
  • 1
  • 10
  • 16
1
vote
1 answer

Fish shell startup command prints � characters on Hyper

I have the following problem with the fish shell on my mac. I recently figured how to modify the ~/.config/fish/config.fish to automatically run a command upon starting the terminal. Now, I want to run a particular script that prints some ASCII art,…
1
vote
1 answer

Rust AWS API Gateway Service Proxy to S3 file upload using raw https request

Firstly, sorry for the long title. I've set up an api gateway to act as the s3 proxy so I can upload files by sending a PUT request to a api url. The api works fine (or at least I think it does), but it seems that I can only upload text files…
zhywu
  • 1,012
  • 1
  • 12
  • 26
1
vote
1 answer

"trait core::ops::Fn<(Request, Response)> is not implemented" for a closure when passing a connection pool to a Hyper handler

I'm trying to build a small web service in Rust using Hyper and r2d2, but I'm running into some issues concerning traits. I'm unable to parse the error message thrown by the compiler, so I was hoping someone could help me out. Consider the following…
Martijn
  • 586
  • 5
  • 19
1
vote
1 answer

Hyper POST request always yields 400

I am trying to send a POST request to a site using Hyper 0.9. The request works with curl: curl https://api.particle.io/v1/devices/secret/set_light -d args=0 -d access_token=secret and Python: import requests r =…
luke
  • 1,024
  • 3
  • 11
  • 21
1
vote
2 answers

Pass data for GET request using Hyper

I am working on a Twitter API for Rust and am running into issues with passing arguments to my GET request. The code I'm using for the request is given below. data_body is something like "screen_name=a_user" and the authorization header is the OAuth…
hamersaw
  • 55
  • 2
  • 5
1
vote
1 answer

Unresolved import when calling a macro defined in an external crate

I am trying to implement a custom HTTP header using impl_header macro from hyper crate but it seems it cannot resolve the hyper::header module. Here is my code: #[macro_use] extern crate hyper; use hyper::header; struct…
mhristache
  • 2,038
  • 3
  • 20
  • 19