Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
Fetch Post Method Empty upon arrival at API

I am trying to send a web-push subscription object to my API, which consists of 'endpoint' and 'keys'.

The problem I seem to be having is when this object reaches my API it has the 'Keys' values but the 'endpoint' value is null. Yet when I debug it I can confirm that the endpoint value is defined.

This is the JS code I am using:

async function Subscribe() {
        let sw = await navigator.serviceWorker.ready;
        let push = await sw.pushManager.subscribe({
            userVisibleOnly: true,
            applicationServerKey:
                'ApplicationServerKeyHere'
        });
        console.log(JSON.stringify(push)); //Store this in DB

        fetch("https://localhost:44325/Subscribe", {
            method: "POST",
            //credentials: "same-origin", // include, *same-origin, omit
            headers: {
                "Content-Type": "application/json"
            },
            body: JSON.stringify(push)
        });
    }

endpoint is populated before the Fetch POST is sent:

enter image description here

And then empty when it arrives at the API:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The incoming JSON has 'endpoint' as field while your DOTNET model class as 'enpoint' as field (mismatch in field names in json-payload and model class that will accept the json payload)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!