Finished routing, simple website now works yay

This commit is contained in:
Hannah-Dagemark 2024-04-18 16:01:30 +02:00
commit 7a112697ec
11 changed files with 148 additions and 15 deletions

View file

@ -2,14 +2,13 @@ class Request
attr_reader :method, :resource, :version, :headers, :params
def initialize(input)
@input = input
variable_definer(@input)
variable_definer(input)
end
private
def variable_definer(input) ##Defines required class variables by splitting up the input text
rows = input.split(/\n/)
rows = input.split(/\r\n/)
@method, @resource, @version = rows[0].split(' ')
@headers, @params = {}, {}
if rows.find_index("") != nil then