Skip to content

Commit

Permalink
Merge branch 'master' into issue/2700
Browse files Browse the repository at this point in the history
Conflicts:
	internal/httpclientx/DESIGN.md
	internal/httpclientx/getraw.go
	internal/httpclientx/overlapped.go
  • Loading branch information
bassosimone committed Apr 26, 2024
2 parents dac7b8f + 3a4652e commit 04b0071
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
10 changes: 3 additions & 7 deletions internal/httpclientx/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ originally derived from `httpx`. Anyways, better to double check.

We compare to `httpapi.Call` and `httpx.GetJSONWithQuery`.

| ------------------------- | ------- | ------- | ----- |
| Operation | GetJSON | httpapi | httpx |
| ------------------------- | ------- | ------- | ----- |
| enforce a call timeout | NO | yes | NO |
Expand Down Expand Up @@ -238,7 +237,6 @@ the caller try parsing the body and failing if it is indeed truncated.

Here we're comparing to `httpapi.Call` and `httpx.FetchResource`.

| ------------------------- | ------- | ------- | ----- |
| Operation | GetRaw | httpapi | httpx |
| ------------------------- | ------- | ------- | ----- |
| enforce a call timeout | NO | yes | NO |
Expand All @@ -260,12 +258,13 @@ Here we're comparing to `httpapi.Call` and `httpx.FetchResource`.
| log response body | yes | yes | yes |
| handle non-200 response | ️ yes | yes* | yes |

Here we can basically make equivalent remarks as those of the previous section.

#### GetXML

There's no direct equivalent of `GetXML` in `httpapi` and `httpx`. Therefore, when using these
two APIs, the caller would need to fetch a raw body and then manually parse XML.

| ------------------------- | ------- | ------- | ----- |
| Operation | GetXML | httpapi | httpx |
| ------------------------- | ------- | ------- | ----- |
| enforce a call timeout | NO | N/A | N/A |
Expand Down Expand Up @@ -294,7 +293,6 @@ Because comparison is not possible, there is not much else to say.

Here we're comparing to `httpapi.Call` and `httpx.PostJSON`.

| ------------------------- | -------- | ------- | ----- |
| Operation | PostJSON | httpapi | httpx |
| ------------------------- | -------- | ------- | ----- |
| marshal JSON | yes | yes~ | yes |
Expand Down Expand Up @@ -416,7 +414,5 @@ with invocations of `*Overlapped`;
The current implementation of `*Overlapped` may cause us to do more work than needed in
case the network is really slow and an attempt is slowly fetching the body. In such a case,
starting a new attempt duplicayes work. Handling this case does not seem straightforward
starting a new attempt duplicates work. Handling this case does not seem straightforward
currently, therefore, we will focus on this as part of future work.
2 changes: 1 addition & 1 deletion internal/httpclientx/getraw.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package httpclientx

//
// getraw.go - GET a RAW response.
// getraw.go - GET a raw response.
//

import (
Expand Down
1 change: 1 addition & 0 deletions internal/httpclientx/overlapped.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Overlapped[Output any] struct {
RunFunc func(ctx context.Context, URL string) (Output, error)

// ScheduleInterval is the MANDATORY scheduling interval.
//
// This field is typically initialized by [NewOverlappedGetJSON], [NewOverlappedGetRaw],
// [NewOverlappedGetXML], or [NewOverlappedPostJSON] to be [OverlappedDefaultScheduleInterval].
//
Expand Down

0 comments on commit 04b0071

Please sign in to comment.