Skip to content

Commit 9f90cc1

Browse files
authored
comments: update MsgTestController with dtm server compatibility note (#83)
- Add comment explaining compatibility changes in dtm server v1.10 - Highlight changes in HTTP status code handling- Reference specific code in dtm/client/dtmcli/utils.go for implementation details
1 parent d6436bf commit 9f90cc1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

samples/DtmSample/Controllers/MsgTestController.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ public async Task<IActionResult> MsgMySqlQueryPrepared(CancellationToken cancell
187187

188188
/// <summary>
189189
/// MSG QueryPrepared(mssql)
190+
///
191+
/// tips: Starting with server v1.10, dtm server changed to use the http status code, but was compatible with the body returned by older versions
192+
/// The http status code 200 with unrecognized body It will be as normal!
193+
/// eg: v1.18.0 [dtm/client/dtmcli/utils.go · dtm-labs/dtm](https://github.com/dtm-labs/dtm/blob/v1.18.0/client/dtmcli/utils.go)
194+
/// func HTTPResp2DtmError(resp *resty.Response) error {
195+
/// code := resp.StatusCode()
196+
/// str := resp.String()
197+
/// if code == http.StatusTooEarly || strings.Contains(str, ResultOngoing) {
198+
/// return ErrorMessage2Error(str, ErrOngoing)
199+
/// } else if code == http.StatusConflict || strings.Contains(str, ResultFailure) {
200+
/// return ErrorMessage2Error(str, ErrFailure)
201+
/// } else if code != http.StatusOK {
202+
/// return errors.New(str)
203+
/// }
204+
/// return nil
205+
/// }
190206
/// </summary>
191207
/// <param name="cancellationToken"></param>
192208
/// <returns></returns>

0 commit comments

Comments
 (0)