Initial Commit

Base Script with a Rake Verification
This commit is contained in:
Hannah-Dagemark 2023-11-20 10:16:45 +01:00
commit 41e6fd2cdc
11 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,6 @@
GET /examples HTTP/1.1
Host: example.com
User-Agent: ExampleBrowser/1.0
Accept-Encoding: gzip, deflate
Accept: */*

View file

@ -0,0 +1,6 @@
GET /fruits?type=bananas&minrating=4 HTTP/1.1
Host: fruits.com
User-Agent: ExampleBrowser/1.0
Accept-Encoding: gzip, deflate
Accept: */*

View file

@ -0,0 +1,4 @@
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: fr

View file

@ -0,0 +1,6 @@
POST /login HTTP/1.1
Host: foo.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 39
username=grillkorv&password=verys3cret!

25
spec/http_parser_spec.rb Normal file
View file

@ -0,0 +1,25 @@
require_relative 'spec_helper'
require_relative '../lib/Request'
describe 'Request' do
describe 'Simple get-request' do
it 'parses the http verb' do
@request = Request.new(File.read('./spec/example_requests/get-index.request.txt'))
_(@request.method).must_equal "GET"
end
it 'parses the resource' do
@request = Request.new(File.read('./spec/example_requests/get-index.request.txt'))
_(@request.resource).must_equal "/"
end
end
describe 'get-requests with url params' do
end
end

1
spec/spec_helper.rb Normal file
View file

@ -0,0 +1 @@
require 'minitest/autorun'