rename all WriteResult to Flush

This commit is contained in:
2024-09-20 22:15:24 +03:00
parent 9925b3a2e5
commit 63c7c65a00
4 changed files with 13 additions and 13 deletions

View File

@@ -87,6 +87,6 @@ func (ash *ATSessionHandler) Output(rqs handlers.RequestSession) (handlers.Reque
return rqs, err
}
_, err = rqs.Engine.WriteResult(rqs.Ctx, rqs.Writer)
_, err = rqs.Engine.Flush(rqs.Ctx, rqs.Writer)
return rqs, err
}

View File

@@ -69,7 +69,7 @@ func TestATSessionHandler_ServeHTTP(t *testing.T) {
mh.GetRequestParserFunc = func() handlers.RequestParser { return mrp }
mh.OutputFunc = func(rs handlers.RequestSession) (handlers.RequestSession, error) { return rs, nil }
mh.ResetFunc = func(rs handlers.RequestSession) (handlers.RequestSession, error) { return rs, nil }
me.WriteResultFunc = func(context.Context, io.Writer) (int, error) { return 0, nil }
me.FlushFunc = func(context.Context, io.Writer) (int, error) { return 0, nil }
},
formData: url.Values{
"phoneNumber": []string{"+1234567890"},
@@ -178,7 +178,7 @@ func TestATSessionHandler_Output(t *testing.T) {
input: handlers.RequestSession{
Continue: true,
Engine: &httpmocks.MockEngine{
WriteResultFunc: func(context.Context, io.Writer) (int, error) {
FlushFunc: func(context.Context, io.Writer) (int, error) {
return 0, nil
},
},
@@ -192,7 +192,7 @@ func TestATSessionHandler_Output(t *testing.T) {
input: handlers.RequestSession{
Continue: false,
Engine: &httpmocks.MockEngine{
WriteResultFunc: func(context.Context, io.Writer) (int, error) {
FlushFunc: func(context.Context, io.Writer) (int, error) {
return 0, nil
},
},
@@ -202,11 +202,11 @@ func TestATSessionHandler_Output(t *testing.T) {
expectedError: false,
},
{
name: "WriteResult error",
name: "Flush error",
input: handlers.RequestSession{
Continue: true,
Engine: &httpmocks.MockEngine{
WriteResultFunc: func(context.Context, io.Writer) (int, error) {
FlushFunc: func(context.Context, io.Writer) (int, error) {
return 0, errors.New("write error")
},
},