-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathresponse.go
More file actions
36 lines (31 loc) · 1.05 KB
/
Copy pathresponse.go
File metadata and controls
36 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2017 The qurl Authors. All rights reserved.
package qurl
// attribute represents a key, value pair of strrings fromn an HTML node
// property.
type attribute struct {
Key string `json:"key"`
Value string `json:"value"`
}
// element represents a simplified HTML element node. It only supports the node
// name and a list of attributes.
type element struct {
Text string `json:"text"`
Attributes []*attribute `json:"attributes"`
}
// Response represents the result struct received after querying an URL.
// Contains information about the URL and the data retrieved after proessing
// the content.
type Response struct {
URL string `json:"url"`
Status int `json:"status"`
Headers map[string][]string `json:"headers,omitempty"`
Selectors map[string][]*element `json:"selectors,omitempty"`
}
// NewResponse returns a new response instance.
func NewResponse() *Response {
response := Response{
Headers: make(map[string][]string),
Selectors: make(map[string][]*element),
}
return &response
}