In the serializer, generated endpoint information will overwrite the one from the context, like here. For example if users specify using http: scheme from the client, it will be ignored here. To fix it, we should reverse the order like:
return new __HttpRequest({
protocol: "https",
method: "PUT",
headers: headers,
path: resolvedPath,
body: body,
...context.endpoint,
});