Sha256: c00f8975d0a513225dc5f1398deb921f990b001e480224f1d61ead7d1d1c23cf

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

$: << 'lib' << '../../lib'

require 'z-http'
require 'z-http/middleware/digest_auth'

digest_config = {
  :username => 'digest_username',
  :password => 'digest_password'
}

ZMachine.run do

  conn_handshake = ZMachine::HttpRequest.new('http://localhost:3000')
  http_handshake = conn_handshake.get

  http_handshake.callback do
    conn = ZMachine::HttpRequest.new('http://localhost:3000')
    conn.use ZMachine::Middleware::DigestAuth, http_handshake.response_header['WWW_AUTHENTICATE'], digest_config
    http = conn.get
    http.callback do
      puts http.response
      ZMachine.stop
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
z-http-request-0.2.0 examples/digest_auth/client.rb
z-http-request-0.1.0 examples/digest_auth/client.rb