mirror of
https://github.com/wneessen/go-hibp.git
synced 2024-11-23 13:20:51 +01:00
Compare commits
No commits in common. "bff329f46cc3e3bfc4ead9177db39647d70eb501" and "1bff71201d2306361c226ed40139636ba7ea7e1a" have entirely different histories.
bff329f46c
...
1bff71201d
2 changed files with 0 additions and 30 deletions
16
breach.go
16
breach.go
|
@ -161,22 +161,6 @@ func (b *BreachAPI) BreachByName(n string, options ...BreachOption) (*Breach, *h
|
||||||
return bd, hr, nil
|
return bd, hr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LatestBreach returns the single most recent breach
|
|
||||||
func (b *BreachAPI) LatestBreach() (*Breach, *http.Response, error) {
|
|
||||||
au := fmt.Sprintf("%s/latestbreach", BaseURL)
|
|
||||||
hb, hr, err := b.hibp.HTTPResBody(http.MethodGet, au, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, hr, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var bd *Breach
|
|
||||||
if err := json.Unmarshal(hb, &bd); err != nil {
|
|
||||||
return nil, hr, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return bd, hr, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DataClasses are attribute of a record compromised in a breach. This method returns a list of strings
|
// DataClasses are attribute of a record compromised in a breach. This method returns a list of strings
|
||||||
// with all registered data classes known to HIBP
|
// with all registered data classes known to HIBP
|
||||||
func (b *BreachAPI) DataClasses() ([]string, *http.Response, error) {
|
func (b *BreachAPI) DataClasses() ([]string, *http.Response, error) {
|
||||||
|
|
|
@ -162,20 +162,6 @@ func TestBreachAPI_BreachByName_Errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestBreachAPI_LatestBreach tests the LatestBreach method of the breaches API
|
|
||||||
func TestBreachAPI_LatestBreach(t *testing.T) {
|
|
||||||
hc := New()
|
|
||||||
breach, _, err := hc.BreachAPI.LatestBreach()
|
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if breach == nil {
|
|
||||||
t.Error("No breach returned")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestBreachAPI_DataClasses tests the DataClasses() method of the breaches API
|
// TestBreachAPI_DataClasses tests the DataClasses() method of the breaches API
|
||||||
func TestBreachAPI_DataClasses(t *testing.T) {
|
func TestBreachAPI_DataClasses(t *testing.T) {
|
||||||
hc := New()
|
hc := New()
|
||||||
|
|
Loading…
Reference in a new issue