@@ -13,18 +13,18 @@ import (
1313// file := httpmock.File("file.txt")
1414// fmt.Printf("file: %s\n", file)
1515//
16- // prints the content of file "file.txt" as String() method is used.
16+ // prints the content of file "file.txt" as [File. String] method is used.
1717//
1818// To print the file name, and not its content, simply do:
1919//
2020// file := httpmock.File("file.txt")
2121// fmt.Printf("file: %s\n", string(file))
2222type File string
2323
24- // MarshalJSON implements json.Marshaler.
24+ // MarshalJSON implements [encoding/ json.Marshaler] .
2525//
26- // Useful to be used in conjunction with NewJsonResponse() or
27- // NewJsonResponder() as in:
26+ // Useful to be used in conjunction with [ NewJsonResponse] or
27+ // [ NewJsonResponder] as in:
2828//
2929// httpmock.NewJsonResponder(200, httpmock.File("body.json"))
3030func (f File ) MarshalJSON () ([]byte , error ) {
@@ -38,8 +38,8 @@ func (f File) bytes() ([]byte, error) {
3838// Bytes returns the content of file as a []byte. If an error occurs
3939// during the opening or reading of the file, it panics.
4040//
41- // Useful to be used in conjunction with NewBytesResponse() or
42- // NewBytesResponder() as in:
41+ // Useful to be used in conjunction with [ NewBytesResponse] or
42+ // [ NewBytesResponder] as in:
4343//
4444// httpmock.NewBytesResponder(200, httpmock.File("body.raw").Bytes())
4545func (f File ) Bytes () []byte {
@@ -50,11 +50,12 @@ func (f File) Bytes() []byte {
5050 return b
5151}
5252
53- // String returns the content of file as a string. If an error occurs
54- // during the opening or reading of the file, it panics.
53+ // String implements [fmt.Stringer] and returns the content of file as
54+ // a string. If an error occurs during the opening or reading of the
55+ // file, it panics.
5556//
56- // Useful to be used in conjunction with NewStringResponse() or
57- // NewStringResponder() as in:
57+ // Useful to be used in conjunction with [ NewStringResponse] or
58+ // [ NewStringResponder] as in:
5859//
5960// httpmock.NewStringResponder(200, httpmock.File("body.txt").String())
6061func (f File ) String () string {
0 commit comments