mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
handle base url later
This commit is contained in:
parent
3a667a3809
commit
d185fb6dd7
@ -42,7 +42,7 @@ func first(vals ...string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (f *jsonFeed) convert(base string) *Feed {
|
||||
func (f *jsonFeed) convert() *Feed {
|
||||
feed := &Feed{
|
||||
Title: f.Title,
|
||||
SiteURL: f.SiteURL,
|
||||
@ -67,11 +67,11 @@ func (f *jsonFeed) convert(base string) *Feed {
|
||||
return feed
|
||||
}
|
||||
|
||||
func ParseJSON(data io.Reader, base string) (*Feed, error) {
|
||||
func ParseJSON(data io.Reader) (*Feed, error) {
|
||||
feed := new(jsonFeed)
|
||||
decoder := json.NewDecoder(data)
|
||||
if err := decoder.Decode(&feed); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return feed.convert(base), nil
|
||||
return feed.convert(), nil
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func TestJSONFeed(t *testing.T) {
|
||||
"url": "https://example.org/initial-post"
|
||||
}
|
||||
]
|
||||
}`), "https://example.com")
|
||||
}`))
|
||||
want := &Feed{
|
||||
Title: "My Example Feed",
|
||||
SiteURL: "https://example.org/",
|
||||
|
Loading…
x
Reference in New Issue
Block a user