Skip to content

Commit

Permalink
refactor: update framework methods to use new response format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed Oct 28, 2024
1 parent 61cbb95 commit baa4c1c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion protocol/api/api_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func ApiVersions(b *protocol.Broker, requestBody *ApiVersionsRequestBody) (*ApiV
return nil, err
}

_, apiVersionsResponse, err := DecodeApiVersionsHeaderAndResponse(response, requestBody.Version, logger.GetLogger(true, ""))
_, apiVersionsResponse, err := DecodeApiVersionsHeaderAndResponse(response.Payload, requestBody.Version, logger.GetLogger(true, ""))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/api/describe_topic_partitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func DescribeTopicPartitions(b *protocol.Broker) (*DescribeTopicPartitionsRespon
return nil, err
}

_, DescribeTopicPartitionsResponse, err := DecodeDescribeTopicPartitionsHeaderAndResponse(response, logger.GetLogger(true, ""))
_, DescribeTopicPartitionsResponse, err := DecodeDescribeTopicPartitionsHeaderAndResponse(response.Payload, logger.GetLogger(true, ""))
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions protocol/api/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kafkaapi

import (
"fmt"

realdecoder "github.com/codecrafters-io/kafka-tester/protocol/decoder"
realencoder "github.com/codecrafters-io/kafka-tester/protocol/encoder"

Expand Down Expand Up @@ -125,9 +126,9 @@ func fetch(b *protocol.Broker, requestBody *FetchRequestBody, logger *logger.Log
return nil, err
}

protocol.PrintHexdump(response)
protocol.PrintHexdump(response.RawBytes)

_, fetchResponse, err := DecodeFetchHeaderAndResponse(response, 16, logger)
_, fetchResponse, err := DecodeFetchHeaderAndResponse(response.Payload, 16, logger)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit baa4c1c

Please sign in to comment.