Skip to content

"WORKAROUND for sending class as request body in multipart/form-data" is missing path parameter #57

Description

@rperne

Hi there, still great work, thank you so much.

in v3.8 or v4.0, we have noticed a missing path parameter transmission when multi/part data is involved
api_client_generator.dart has a "// WORKAROUND for sending class as request body in multipart/form-data"

but when a path parameter is given,

extension FormDataClientX on FormDataClient {
  Future<HttpResponse<FormData>> updateDataById({
    required FormData requestBody,
    @Path("id") required String id,
    @Extras() Map<String, dynamic>? extras,
    @CancelRequest() CancelToken? cancelToken,
    @SendProgress() ProgressCallback? onSendProgress,
    @ReceiveProgress() ProgressCallback? onReceiveProgress,
  }) {
    return updateDataById_(
      requestBody: requestBody.toJson(),
      extras: extras,
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
    );
  }
}

the internal method has the id parameter

  @PUT("/formData/{id}")
  @MultiPart()
  Future<HttpResponse<FormData>> updateDataById_({
    @Part() required Map<String, dynamic> requestBody,
    @Path("id") required String id,
    @Extras() Map<String, dynamic>? extras,
    @CancelRequest() CancelToken? cancelToken,
    @SendProgress() ProgressCallback? onSendProgress,
    @ReceiveProgress() ProgressCallback? onReceiveProgress,
  });

we can see that the internal call is missing the required id parameter

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions