<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pakakeh.go/lib/http/example_server_test.go, branch dev</title>
<subtitle>Collections of packages and tools for working with Go programming language.</subtitle>
<id>http://git.kilabit.info/pakakeh.go/atom?h=dev</id>
<link rel='self' href='http://git.kilabit.info/pakakeh.go/atom?h=dev'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/'/>
<updated>2024-03-08T18:10:24Z</updated>
<entry>
<title>lib/http: rename files for consistency</title>
<updated>2024-03-08T18:10:24Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-07T19:19:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=4e35c509a41cecb207bf6f52e7c9a529fa9f71fb'/>
<id>urn:sha1:4e35c509a41cecb207bf6f52e7c9a529fa9f71fb</id>
<content type='text'>
If the type is in CamelCase the file should be using snake_case.
</content>
</entry>
<entry>
<title>all: comply with linter recommendations #2</title>
<updated>2024-03-05T07:53:12Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-02T21:59:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=2fa7605727e90ca323b7b24168632e485d74c583'/>
<id>urn:sha1:2fa7605727e90ca323b7b24168632e485d74c583</id>
<content type='text'>
HTTP request now implicitly create request with context.

Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".

In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.

An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.

Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.

Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.

Any if-else condition now replaced with switch statement, if possible.
</content>
</entry>
<entry>
<title>all: comply with linter recommendations #1</title>
<updated>2024-03-05T07:53:03Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2024-03-02T11:28:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=b921ebfb3e81b367ff24305eb18c5dd073b38635'/>
<id>urn:sha1:b921ebfb3e81b367ff24305eb18c5dd073b38635</id>
<content type='text'>
Instead of annotating the lines that caught by linters, fix it to comply
with the recommendations.

This causes several breaking changes, especially related to naming,

* api/slack: [Message.IconUrl] become [Message.IconURL]
* lib/dns: DefaultSoaMinumumTtl become DefaultSoaMinimumTTL
* lib/email: [Message.SetBodyHtml] become [Message.SetBodyHTML]
* lib/http: [Client.GenerateHttpRequest] become
  [Client.GenerateHTTPRequest]
* lib/http: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/http: [EndpointRequest.HttpWriter] become
  [EndpointRequest.HTTPWriter]
* lib/http: [EndpointRequest.HttpRequest] become
  [EndpointRequest.HTTPRequest]
* lib/http: [ServerOptions.EnableIndexHtml] become
  [ServerOptions.EnableIndexHTML]
* lib/http: [SSEConn.HttpRequest] become [SSEConn.HTTPRequest]
* lib/smtp: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/ssh/sftp: [FileAttrs.SetUid] become [FileAttrs.SetUID]
* lib/ssh/sftp: [FileAttrs.Uid] become [FileAttrs.UID]
</content>
</entry>
<entry>
<title>all: fix variable shadowing as reported by shadow tool</title>
<updated>2023-09-13T17:59:40Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2023-09-13T17:59:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=b89afa24feaee375e914a69b23c2036733991f3e'/>
<id>urn:sha1:b89afa24feaee375e914a69b23c2036733991f3e</id>
<content type='text'>
The shadow tool [1] report a variable where its name is declared twice
or more, in different scope.

[1] https://pkg.go.dev/golang.org/x/tools@v0.13.0/go/analysis/passes/shadow
</content>
</entry>
<entry>
<title>lib/http: refactoring NewClient to accept single struct</title>
<updated>2022-01-09T15:44:43Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2022-01-01T20:05:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=0e49559d0effb845c8392e00a3b860464ed88002'/>
<id>urn:sha1:0e49559d0effb845c8392e00a3b860464ed88002</id>
<content type='text'>
Previously, the NewClient function accept three parameters: serverURL,
http.Header, and insecure.  If we want to add another parameter,
for example timeout it will cause changes on the function signature.

To prevent this changes in the future, we change it now. The NewClient
now accept single struct.

While at it, we add option to set Timeout.

The Timeout affect the http Transport Timeout and TLSHandshakeTimeout.
The field is optional, if not set it will set to 10 seconds.
</content>
</entry>
<entry>
<title>lib/http: add missing license header</title>
<updated>2021-07-30T11:51:49Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-07-30T11:51:49Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=2e629610f79583fdf25900715bfdee7fb48d656f'/>
<id>urn:sha1:2e629610f79583fdf25900715bfdee7fb48d656f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>all: refactoring http.Client methods signature</title>
<updated>2021-03-14T15:51:46Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-03-14T15:51:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=25fb633ee6ab446917af8dcd2f9b303e85a13c98'/>
<id>urn:sha1:25fb633ee6ab446917af8dcd2f9b303e85a13c98</id>
<content type='text'>
Previously, parameters to method Delete, Get, Post, PostForm, PostFormData,
PostJSON, Put, and PutJSON are in the following order:

  (headers, path, params)

This is sometimes confusing. To make it better and works with format
of HTTP request header,

  METHOD PATH
  HEADERS

  PARAMS

we move the path to the first parameter and headers as the second
parameter, so the call to client methods would be

  (path, headers, params)
</content>
</entry>
<entry>
<title>http: refactoring parameters on Callback and CallbackErrorHandler</title>
<updated>2021-03-03T20:31:44Z</updated>
<author>
<name>Shulhan</name>
<email>ms@kilabit.info</email>
</author>
<published>2021-03-03T20:31:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=6442d1f4055a5a24eed8510de853e226452a4125'/>
<id>urn:sha1:6442d1f4055a5a24eed8510de853e226452a4125</id>
<content type='text'>
Previously, the parameters to Callback has three types:
the http.ResponseWriter, *http.Request, and []byte for response body.
Not only the type names are long, there is no information on the
registered Endpoint on the receiver of Callback.

This changes wrap the three parameters into single type EndpointRequest
with addition field Endpoint, which contains the registered Endpoint.

On the CallbackErrorHandler we also have three parameters, but instead
of request body we have an error.

This changes store the error for CallbackErrorHandler inside
EndpointRequest.Error field.
</content>
</entry>
<entry>
<title>http: ignore errors in the example codes</title>
<updated>2021-01-05T18:28:23Z</updated>
<author>
<name>Shulhan</name>
<email>m.shulhan@gmail.com</email>
</author>
<published>2021-01-05T18:28:23Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=0ed90ec3bb2de99ebfa4e8db59dce42db16c352f'/>
<id>urn:sha1:0ed90ec3bb2de99ebfa4e8db59dce42db16c352f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>http: add an example on how to write custom HTTP status code</title>
<updated>2020-11-27T11:59:36Z</updated>
<author>
<name>Shulhan</name>
<email>m.shulhan@gmail.com</email>
</author>
<published>2020-11-27T11:59:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/pakakeh.go/commit/?id=e46ab6bc3b6aed18fd11269a578c7b9614fc2e4b'/>
<id>urn:sha1:e46ab6bc3b6aed18fd11269a578c7b9614fc2e4b</id>
<content type='text'>
The example show how to use http.ResponseWriter.WriteHeader to write
custom HTTP status code instead of relying on errors.E.
</content>
</entry>
</feed>
