Sha256: 0ff0cd1aef67ac777eebc79896e387b7a06402d2655502cd0d5fb50e1b4c221f

Contents?: true

Size: 1020 Bytes

Versions: 13

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2024, by Samuel Williams.

def build
	# Fetch the code:
	system "go get github.com/spf13/cobra"
	system "go get github.com/summerwind/h2spec"
	
	# This builds `h2spec` into the current directory
	system "go build ~/go/src/github.com/summerwind/h2spec/cmd/h2spec/h2spec.go"
end

def test
	server do
		system("./h2spec", "-p", "7272")
	end
end

private

def server
	require "async"
	require "async/container"
	require "async/http/server"
	require "io/endpoint/host_endpoint"
	
	endpoint = IO::Endpoint.tcp("127.0.0.1", 7272)
	
	container = Async::Container.new
	
	Console.logger.info(self){"Starting server..."}
	
	container.run(count: 1) do
		server = Async::HTTP::Server.for(endpoint, protocol: Async::HTTP::Protocol::HTTP2, scheme: "https") do |request|
			Protocol::HTTP::Response[200, {"content-type" => "text/plain"}, ["Hello World"]]
		end
		
		Async do
			server.run
		end
	end
	
	yield if block_given?
ensure
	container&.stop
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
async-http-0.84.0 bake/async/http/h2spec.rb
async-http-0.83.1 bake/async/http/h2spec.rb
async-http-0.83.0 bake/async/http/h2spec.rb
async-http-0.82.3 bake/async/http/h2spec.rb
async-http-0.82.2 bake/async/http/h2spec.rb
async-http-0.82.1 bake/async/http/h2spec.rb
async-http-0.82.0 bake/async/http/h2spec.rb
async-http-0.81.0 bake/async/http/h2spec.rb
async-http-0.80.1 bake/async/http/h2spec.rb
async-http-0.80.0 bake/async/http/h2spec.rb
async-http-0.79.0 bake/async/http/h2spec.rb
async-http-0.78.0 bake/async/http/h2spec.rb
async-http-0.77.0 bake/async/http/h2spec.rb