Skip to content

Creating reusable server functions ignores setting the method: "GET" | "POST" #5872

@julianklumpers

Description

@julianklumpers

Which project does this relate to?

Start

Describe the bug

export const publicServerFn = createServerFn().middleware([localeMiddleware]);
export const authenticatedServerFn = publicServerFn.middleware([authMiddleware]);

this works, but there is a small problem. i get TS types for setting a method: "POST" | "GET", but it is not working, i always get a "GET" when setting a "POST"

authenticatedServerFn({ method: "POST" }).handler(...) // still results in a GET

Your Example Website or App

https://codesandbox.io/p/devbox/silly-dan-3lxwm6?workspaceId=ws_6zSt1ovMaptBGeGs92eGau

Steps to Reproduce the Bug or Issue

  1. open the console tab and go to network tab
  2. click "Create Post"
  3. check in the network tab the request method

Expected behavior

When setting {method: "POST"} i expect the server function request to be a "POST" and not a "GET"

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.136.4
  • OS: macOS
  • Browser: Chrome,
  • Browser Version 142.0.7444.162 (Official Build) (arm64)
  • Bundler: vite
  • Bundler Version: 7.1.7

Additional context

No response

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