willnorris / webmention

Go library and CLI for assisting in sending webmentions.
https://pkg.go.dev/willnorris.com/go/webmention
BSD 3-Clause "New" or "Revised" License
50 stars 5 forks source link

Don't treat empty endpoint links as invalid #14

Closed nekr0z closed 3 years ago

nekr0z commented 3 years ago

An empty string is a valid relative URL that points back to the same page where it is. Both HTTP headers and HTML allow relative URLs. When doing endpoint discovery, those are to be treated as valid values and processed.

Since the empty value was used as an inline error signal, I had to introduce a new error value, have functions return it, and fix some tests to expect it where appropriate.

fixes #12

codecov-commenter commented 3 years ago

Codecov Report

Merging #14 (9a70dc2) into main (8052267) will increase coverage by 2.88%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
+ Coverage   70.35%   73.23%   +2.88%     
==========================================
  Files           4        4              
  Lines         199      198       -1     
==========================================
+ Hits          140      145       +5     
+ Misses         39       36       -3     
+ Partials       20       17       -3     
Impacted Files Coverage Δ
third_party/header/header.go 70.70% <ø> (+1.40%) :arrow_up:
html.go 85.36% <100.00%> (+1.15%) :arrow_up:
http.go 100.00% <100.00%> (ø)
webmention.go 66.66% <100.00%> (+5.95%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8052267...9a70dc2. Read the comment docs.

willnorris commented 3 years ago

This looks great, thanks!