we can only use method of get and a url to get GeoJSON data for GeoJSONLayer,
It's too inflexible.
if params is too long，
there will be problems.
i want to load a GeoJSONLayer by GeoJSON data by other custom request ，
how i can i do？
or how can i custom request method and params by official method?
At version 4.22, GeoJSONLayer will support customParameters property where you can set your custom query parameters. GeoJSONLayer will also be a refreshable layer. For example, you can change the customParameters of your GeoJSONLayer at runtime and call refresh method. This will update the layer's data at runtime. You can test this using our next build.
This codepen app shows customParameters and refresh in action. The JS API 4.22 version will be released end of December 2021.
Hope this helps,
You don't have to do anything. The GeoJSONLayer uses esriRequet to fetch the data. If your url query params are more 2000 characters, the esriRequest switches to post automatically. So the GeoJSONLayer will fetch the data no matter how long the url is.