Sha256: 283d9183cdf7d96cd269efc346de6a04b607a158565f5fe12d7db95ddde57001

Contents?: true

Size: 1020 Bytes

Versions: 16

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

16 entries across 16 versions & 1 rubygems

Version Path
async-http-0.76.0 bake/async/http/h2spec.rb
async-http-0.75.0 bake/async/http/h2spec.rb
async-http-0.74.0 bake/async/http/h2spec.rb
async-http-0.73.0 bake/async/http/h2spec.rb
async-http-0.72.0 bake/async/http/h2spec.rb
async-http-0.71.0 bake/async/http/h2spec.rb
async-http-0.70.0 bake/async/http/h2spec.rb
async-http-0.69.0 bake/async/http/h2spec.rb
async-http-0.68.0 bake/async/http/h2spec.rb
async-http-0.67.1 bake/async/http/h2spec.rb
async-http-0.67.0 bake/async/http/h2spec.rb
async-http-0.66.2 bake/async/http/h2spec.rb
async-http-0.66.1 bake/async/http/h2spec.rb
async-http-0.66.0 bake/async/http/h2spec.rb
async-http-0.65.1 bake/async/http/h2spec.rb
async-http-0.65.0 bake/async/http/h2spec.rb