Skip to content

Crash when starting bot without any requestData in startBotParams #32

@eugenDrobov

Description

@eugenDrobov

In function
private func fetchStartBot<T: Decodable>(startBotParams: APIRequest) async throws -> T {
we have these lines
`if let customBodyParams = startBotParams.requestData {
request.httpBody = try JSONEncoder().encode(startBotParams.requestData)
}

        Logger.shared.debug(
            "Fetching from \(String(data: request.httpBody!, encoding: .utf8) ?? "")"
        )`

and if request.httpBody is nil - String(data: request.httpBody!, produces a crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions