Module: ResponseDataFilter
- Includes:
- HttpStatusCode
- Defined in:
- lib/macaw_framework/data_filters/response_data_filter.rb
Overview
Module responsible to filter and mount HTTP responses
Constant Summary
HttpStatusCode::HTTP_STATUS_CODE_MAP
Class Method Summary
collapse
Class Method Details
.mount_first_response_line(status, headers) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/macaw_framework/data_filters/response_data_filter.rb', line 14
def self.mount_first_response_line(status, )
separator = " \r\n\r\n"
separator = " \r\n" unless .nil?
"HTTP/1.1 #{status} #{HTTP_STATUS_CODE_MAP[status]}#{separator}"
end
|
.mount_response(status, headers, body) ⇒ Object
10
11
12
|
# File 'lib/macaw_framework/data_filters/response_data_filter.rb', line 10
def self.mount_response(status, , body)
"#{mount_first_response_line(status, )}#{()}#{body}"
end
|
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/macaw_framework/data_filters/response_data_filter.rb', line 21
def self.()
return '' if .nil?
response = ''
.each do |key, value|
response += "#{key}: #{value}\r\n"
end
response += "\r\n"
response
end
|